burnable-tech / elm-ethereum / Eth.Sentry.Event

Event Sentry - HTTP Style - Polling ftw


type EventSentry msg


type Msg


type alias Ref =
Basics.Int

init : (Msg -> msg) -> Eth.Types.HttpProvider -> ( EventSentry msg, Platform.Cmd.Cmd msg )

stopWatching : Ref -> EventSentry msg -> EventSentry msg

update : Msg -> EventSentry msg -> ( EventSentry msg, Platform.Cmd.Cmd msg )

watch : (Eth.Types.Log -> msg) -> EventSentry msg -> Eth.Types.LogFilter -> ( EventSentry msg, Platform.Cmd.Cmd msg, Ref )

Continuously polls for logs in newly mined blocks.

If the range within the LogFilter includes past blocks, then all events within the given block range are returned, along with events in the latest block.

Polling continues until stopWatching is called.

watchOnce : (Eth.Types.Log -> msg) -> EventSentry msg -> Eth.Types.LogFilter -> ( EventSentry msg, Platform.Cmd.Cmd msg )

Returns the first log found.

If a block range is defined in the LogFilter, this will only return the first log found within that given block range.