ryannhg/elm-spa/5.0.0

NOTE: the latest version is 6.0.0

Renamed to ryan-haskell/elm-spa. It is published under that name, and new versions come out there.

Versions published as ryannhg/elm-spa still install under that name. 13 versions of 13 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/ryan-haskell/elm-spa.

What we checked: The repo moved to github.com/ryan-haskell/elm-spa. Rebuilt with git archive from commit a9e7345cb9b1 of https://github.com/ryan-haskell/elm-spa (zip prefix ryannhg-elm-spa-47bbe9b/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 92bbe5252725d5f3f5a3c0c6e4c493bb5ac8ce00.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/ryannhg/elm-spa/zipball/5.0.0/

ElmSpa.Page

( These docs are for CLI contributors )

If you are using elm-spa, check out the official guide instead!


Every page in elm-spa ultimately becomes one data type: Page

This makes it easy to wire them up in the generated code, because they all have the same type signature.

Note: You won't use ElmSpa.Page directly, instead you'll be using Page, which removes some of the generic type parameters

type alias Page model msg =
    { init : ( model, Cmd msg, List Shared.Msg )
    , update : msg -> model -> ( model, Cmd msg, List Shared.Msg )
    , view : model -> View msg
    , subscriptions : model -> Sub msg
    }

Pages

type alias Page sharedMsg view model msg =
{ init : () -> ( model, Cmd msg, List sharedMsg )
, update : msg -> model -> ( model, Cmd msg, List sharedMsg )
, view : model -> view
, subscriptions : model -> Sub msg
}

The common Page type that each of the functions below creates

Page.static { ... }    -- Page () Never
Page.sandbox { ... }   -- Page Model Msg
Page.element { ... }   -- Page Model Msg
Page.shared { ... }    -- Page Model Msg
static : { view : view } -> Page sharedMsg view () Never

A page that can track state, and respond to user input.

Page.static
    { view = view
    }


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

A page that can track state, and respond to user input.

Page.sandbox
    { init = init
    , update = update
    , view = view
    }


init : Model
update : Msg -> Model -> Model
view : Model -> View Msg
{ init : ( model, Cmd msg )
, update : msg -> model -> ( model, Cmd msg )
, view : model -> view
, subscriptions : model -> Sub msg
}
-> Page sharedMsg view model msg

A page that can send side-effects and subscribe to events.

Page.element
    { init = init
    , update = update
    , subscriptions = subscriptions
    , view = view
    }


init : (Model, Cmd Msg)
update : Msg -> Model -> (Model, Cmd Msg)
view : Model -> View Msg
subscriptions : Model -> Sub Msg
{ init : ( model, Cmd msg, List sharedMsg )
, update : msg -> model -> ( model, Cmd msg, List sharedMsg )
, view : model -> view
, subscriptions : model -> Sub msg
}
-> Page sharedMsg view model msg

A page that allows messages to be sent to the Shared module.

Page.shared
    { init = init
    , update = update
    , subscriptions = subscriptions
    , view = view
    }


init : (Model, Cmd Msg, List Shared.Msg )
update : Msg -> Model -> (Model, Cmd Msg, List Shared.Msg )
view : Model -> View Msg
subscriptions : Model -> Sub Msg