uweg / elm-io-spa / Spa

setup : (flags -> route -> Task error shared) -> (Browser.Navigation.Key -> msg -> IO shared msg) -> view -> (Url -> route) -> Stack () () route msg shared view (Info flags error shared msg route)

Sets up a new SPA.

addPage : ( (IO current msg -> IO (Stack.Model current previous) msg) -> currentView -> view, (IO previous msg -> IO (Stack.Model current previous) msg) -> previousView -> view ) -> Page current flags msg shared currentView -> (route -> Maybe flags) -> Stack previousCurrent previousPrevious route msg shared previousView info -> Stack current (Stack.Model previousCurrent previousPrevious) route msg shared view info

Adds a page to the SPA.

withSubscriptions : (shared -> Platform.Sub.Sub (IO shared msg)) -> Stack () () route msg shared view (Info flags error shared msg route) -> Stack () () route msg shared view (Info flags error shared msg route)

Adds global subscriptions.

withLoadingView : Browser.Document msg -> Stack () () route msg shared view (Info flags error shared msg route) -> Stack () () route msg shared view (Info flags error shared msg route)

Defines view while SPA is loading.

withErrorView : (error -> Browser.Document msg) -> Stack () () route msg shared view (Info flags error shared msg route) -> Stack () () route msg shared view (Info flags error shared msg route)

Defines view on loading error.

onUrlChange : (route -> IO shared msg) -> Stack () () route msg shared view (Info flags error shared msg route) -> Stack () () route msg shared view (Info flags error shared msg route)

Callback when an URL is changed.

toApplication : (shared -> view -> Browser.Document (IO (Stack.Model current previous) msg)) -> Stack current previous route msg shared view (Info flags error shared msg route) -> IO.Program flags (Model current previous shared route error) msg

Converts the SPA to an Elm application.


type Model current previous shared route error


type alias StackModel current previous =
Stack.Model current previous