bornhack-website/schedule/src/Main.elm

52 lines
1.1 KiB
Elm
Raw Normal View History

module Main exposing (..)
-- Local modules
import Models exposing (..)
import Routing exposing (parseLocation)
import Update exposing (update)
import Messages exposing (Msg(..))
2017-07-20 09:18:14 +00:00
import WebSocketCalls exposing (sendInitMessage)
import Views exposing (view)
-- External modules
import WebSocket exposing (listen)
import Navigation exposing (Location)
main : Program Flags Model Msg
main =
Navigation.programWithFlags
OnLocationChange
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
}
init : Flags -> Location -> ( Model, Cmd Msg )
init flags location =
let
currentRoute =
parseLocation location
emptyFilter =
Filter [] [] []
model =
2017-08-02 20:20:38 +00:00
Model [] [] [] [] [] [] flags emptyFilter location currentRoute False
in
model ! [ sendInitMessage flags.camp_slug flags.websocket_server ]
-- SUBSCRIPTIONS
subscriptions : Model -> Sub Msg
subscriptions model =
2017-07-20 09:18:14 +00:00
WebSocket.listen model.flags.websocket_server WebSocketPayload