NoRedInk/elm-sweet-poll/4.0.0

NOTE: this package is not compatible with Elm 0.19.1

SweetPoll

Configuration

type alias Config data =
{ url : String
, decoder : Decoder data
, delay : Time
, samesBeforeDelay : Int
, delayMultiplier : Float
, maxDelay : Time
}
defaultConfig : Decoder data -> String -> Config data

Default configuration for SweetPoll

Elm Artchitecture

type Model data

Private state of the SweetPoll component

type Msg data
init : Config data -> ( Model data, Cmd (Msg data) )
type alias UpdateResult data =
{ sweetPollModel : Model data
, newData : Maybe data
, error : Maybe Error
, cmd : Cmd (Msg data)
}
  • sweetPollModel: the new state of the SweetPoll
  • newData: any new data received by the SweetPoll
  • error: any new error occurring in the current update cycle
  • cmd: a Cmd to keep the SweetPoll running
update : Msg data -> Model data -> UpdateResult data

The SweetPoll StartApp-style update function