2018-02-13 00:32:38 +03:00
|
|
|
module Update exposing (Msg(..), subscriptions, update)
|
|
|
|
|
2018-12-05 01:36:15 +03:00
|
|
|
import Browser
|
2018-02-13 00:32:38 +03:00
|
|
|
import Model exposing (..)
|
|
|
|
import NriModules as NriModules
|
2018-12-05 01:36:15 +03:00
|
|
|
import Url exposing (Url)
|
2018-02-13 00:32:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
type Msg
|
|
|
|
= UpdateModuleStates NriModules.Msg
|
2018-12-05 01:36:15 +03:00
|
|
|
| OnUrlRequest Browser.UrlRequest
|
|
|
|
| OnUrlChange Url
|
2018-02-13 00:32:38 +03:00
|
|
|
| NoOp
|
|
|
|
|
|
|
|
|
|
|
|
update : Msg -> Model -> ( Model, Cmd Msg )
|
|
|
|
update action model =
|
|
|
|
case action of
|
|
|
|
UpdateModuleStates msg ->
|
|
|
|
let
|
|
|
|
( moduleStates, cmd ) =
|
|
|
|
NriModules.update msg model.moduleStates
|
|
|
|
in
|
|
|
|
( { model | moduleStates = moduleStates }
|
|
|
|
, Cmd.map UpdateModuleStates cmd
|
|
|
|
)
|
|
|
|
|
2018-12-05 01:36:15 +03:00
|
|
|
OnUrlRequest request ->
|
|
|
|
-- TODO
|
|
|
|
( model, Cmd.none )
|
|
|
|
|
|
|
|
OnUrlChange route ->
|
|
|
|
-- TODO
|
|
|
|
( model, Cmd.none )
|
2018-02-13 00:32:38 +03:00
|
|
|
|
|
|
|
NoOp ->
|
|
|
|
( model, Cmd.none )
|
|
|
|
|
|
|
|
|
|
|
|
subscriptions : Model -> Sub Msg
|
|
|
|
subscriptions model =
|
|
|
|
Sub.map UpdateModuleStates (NriModules.subscriptions model.moduleStates)
|