orus-io / elm-spa / Spa.Page

Provides Page builders


type alias Page flags sharedMsg view model msg =
Spa.Internal.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:

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

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

sandbox : { 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

element : { init : flags -> ( model, Effect sharedMsg msg ), update : msg -> model -> ( model, Effect sharedMsg msg ), view : model -> view, subscriptions : model -> Platform.Sub.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

onNewFlags : (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.