|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
module Main exposing (main)
|
|
|
|
|
port module Main exposing (main)
|
|
|
|
|
|
|
|
|
|
import Browser
|
|
|
|
|
import Browser.Navigation as Nav
|
|
|
|
@ -21,6 +21,12 @@ main =
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
port wsout : String -> Cmd msg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
port wsin : (String -> msg) -> Sub msg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{-| currently no flags are needed
|
|
|
|
|
that's the reason for the generic type and \_ as param name
|
|
|
|
|
-}
|
|
|
|
@ -45,12 +51,14 @@ init flags url key =
|
|
|
|
|
|
|
|
|
|
subscriptions : Model -> Sub Msg
|
|
|
|
|
subscriptions _ =
|
|
|
|
|
Sub.none
|
|
|
|
|
wsin WsIn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type Msg
|
|
|
|
|
= UrlChanged Url.Url
|
|
|
|
|
| LinkClicked Browser.UrlRequest
|
|
|
|
|
| WsIn String
|
|
|
|
|
| WsOut String
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update : Msg -> Model -> ( Model, Cmd Msg )
|
|
|
|
@ -69,6 +77,12 @@ update msg model =
|
|
|
|
|
-- TODO error reporting
|
|
|
|
|
( { model | route = Navigation.Home }, Cmd.none )
|
|
|
|
|
|
|
|
|
|
WsOut wsmsg ->
|
|
|
|
|
( model, wsout wsmsg )
|
|
|
|
|
|
|
|
|
|
WsIn wsmsg ->
|
|
|
|
|
Debug.log wsmsg ( model, Cmd.none )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
routeChanged : Navigation.Route -> Model -> ( Model, Cmd Msg )
|
|
|
|
|
routeChanged route model =
|
|
|
|
|