Provides Page
builders
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:
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
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.