alex-tan/loadable/3.1.1

NOTE: the latest version is 3.1.2

Loadable

{ update : innerMsg -> innerModel -> ( innerModel, Cmd innerMsg )
, subscriptions : innerModel -> Sub innerMsg
, view : innerModel -> Html innerMsg
, load : flags -> Task e ( innerModel, Cmd innerMsg )
, failCmd : Maybe (e -> Cmd (Msg innerModel innerMsg e))
, loadingView : Maybe (flags -> Html (Msg innerModel innerMsg e))
, errorView : Maybe (e -> Html (Msg innerModel innerMsg e))
}
-> Program flags innerModel innerMsg e

Behaves a lot like element from the Browser package, with a few additions.

  • load replaces init and returns a task that will return your initial model and command.
  • failCmd can be used to send any error that results from the load task through a port.
  • loadingView can take flags and return a loading view.
  • errorView can take any error that results from load and displays an error message.
{ update : innerMsg -> innerModel -> ( innerModel, Cmd innerMsg )
, subscriptions : innerModel -> Sub innerMsg
, view : innerModel -> Document innerMsg
, load : flags -> Url -> Key -> Task e ( innerModel, Cmd innerMsg )
, failCmd : Maybe (e -> Cmd (Msg innerModel innerMsg e))
, loadingView :
Maybe (flags -> Document (Msg innerModel innerMsg e))
, errorView : Maybe (e -> Document (Msg innerModel innerMsg e))
, onUrlRequest : UrlRequest -> innerMsg
, onUrlChange : Url -> innerMsg
}
-> Program flags innerModel innerMsg e

Behaves a lot like application from the Browser package, with a few additions.

  • load replaces init and returns a task that will return your initial model and command.
  • failCmd can be used to send any error that results from the load task through a port.
  • loadingView can take flags and return a loading view.
  • errorView can take any error that results from load and displays an error message.
type alias Program flags model msg error =
Program flags (Model flags model error) (Msg model msg error)

An alias for the Browser.Program that gets produced from this package which makes it easier to add type annotations for your programs.