mthadley/elm-hash-routing/1.0.1

Browser.Hash

Check out the README for more a more in depth explanation of why this package exists. Otherwise, skip down application to get started.

{ init : flags -> Url -> Key -> ( model, Cmd msg )
, view : model -> Document msg
, update : msg -> model -> ( model, Cmd msg )
, subscriptions : model -> Sub msg
, onUrlRequest : UrlRequest -> msg
, onUrlChange : Url -> msg
}
-> Program flags model msg

A replacement for Browser.application that will automatically process your hash-based Url's into ones that will work out of the box with the standard parsing logic of Url.Parser.

It's usage is the same as Browser.application:

import Browser.Hash as Hash


main : Program () Model Msg
main =
    Hash.application
        { init = init
        , view = view
        , update = update
        , subscriptions = subscriptions
        , onUrlChange = App.RouteChange << Router.parse
        , onUrlRequest = App.OnUrlRequest
        }