42 lines
907 B
Elm
42 lines
907 B
Elm
|
module Main exposing (..)
|
||
|
|
||
|
-- Local modules
|
||
|
|
||
|
import Models exposing (..)
|
||
|
import Routing exposing (parseLocation)
|
||
|
import Update exposing (update)
|
||
|
import Messages exposing (Msg(..))
|
||
|
import WebSocketCalls exposing (scheduleServer, 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 =
|
||
|
( Model [] [] [] [] [] flags allDaysDay (Filter [] []) (parseLocation location), sendInitMessage flags.camp_slug )
|
||
|
|
||
|
|
||
|
|
||
|
-- SUBSCRIPTIONS
|
||
|
|
||
|
|
||
|
subscriptions : Model -> Sub Msg
|
||
|
subscriptions model =
|
||
|
WebSocket.listen scheduleServer WebSocketPayload
|