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 0f8cc5975728 of https://github.com/ryan-haskell/elm-spa (zip prefix ryannhg-elm-spa-a6cff43/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 a78b13a810a6d2699c69edddb9e5621190a3e006.
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.1.0/
A page that only needs to render a static view.
import Page
page : Page () Never
page =
Page.static
{ view = view
}
-- view : View NeverA page that can keep track of application state.
( Inspired by Browser.sandbox )
import Page
page : Page Model Msg
page =
Page.sandbox
{ init = init
, update = update
, view = view
}
-- init : Model
-- update : Msg -> Model -> Model
-- view : Model -> View MsgA page that can handle effects like HTTP requests or subscriptions.
( Inspired by Browser.element )
import Page
page : Page Model Msg
page =
Page.element
{ init = init
, update = update
, view = view
, subscriptions = subscriptions
}
-- init : ( Model, Cmd Msg )
-- update : Msg -> Model -> ( Model, Cmd Msg )
-- view : Model -> View Msg
-- subscriptions : Model -> Sub MsgA page that can handles custom effects like sending a Shared.Msg or other general user-defined effects.
import Effect
import Page
page : Page Model Msg
page =
Page.advanced
{ init = init
, update = update
, view = view
, subscriptions = subscriptions
}
-- init : ( Model, Effect Msg )
-- update : Msg -> Model -> ( Model, Effect Msg )
-- view : Model -> View Msg
-- subscriptions : Model -> Sub MsgPrefixing any of the four functions above with protected will guarantee that the page has access to a user. Here's an example with sandbox:
import Page
page : Page Model Msg
page =
Page.protected.sandbox
{ init = init
, update = update
, view = view
}
-- init : User -> Model
-- update : User -> Msg -> Model -> Model
-- update : User -> Model -> View MsgThis function is used by the generated code to connect your pages together.
It's big, spooky, and makes writing elm-spa pages really nice!
Pages are the building blocks of elm-spa.
Instead of importing this module, your project will have a
Pagemodule with a much simpler type:This makes all the generic
route,effect, andviewarguments disappear!