orus-io/elm-spa/3.0.0

NOTE: the latest version is 3.0.1

Spa.Page

Provides Page builders

type alias Page flags sharedMsg view model msg =
Page flags sharedMsg view model msg

A page is a small TEA app on its own.

It has the typical Msg, Model, init, update, subscriptions and view. It differs from a normal application in a few ways:

  • The init and update functions return Effect Shared.Msg Msg instead of Cmd Msg.

  • The init function takes a unique flags argument that is the output of the page match function (see Spa.addPublicPage).

  • The view function returns a View Msg, which can be whatever you define.

static : view -> Page flags sharedMsg view () ()

Create a static page that has no states, only a view

{ init : flags -> model
, update : msg -> model -> model
, view : model -> view
}
-> Page flags sharedMsg view model msg

Create a "sandboxed" page that cannot communicate with the outside world.

It is the page equivalent of a sanboxed program

{ init : flags -> ( model, Effect sharedMsg msg )
, update : msg -> model -> ( model, Effect sharedMsg msg )
, view : model -> view
, subscriptions : model -> Sub msg
}
-> Page flags sharedMsg view model msg

Create a page that can communicate with the outside world.

It is the page equivalent of a element program

(flags -> msg)
-> Page flags sharedMsg view model msg
-> Page flags sharedMsg view model msg

Set the message to pass when the flags change. If not set, the 'init' function is called, resulting in a complete reset of the page model.