diff options
author | Joris | 2016-09-04 21:21:11 +0200 |
---|---|---|
committer | Joris | 2016-09-04 21:21:31 +0200 |
commit | 973a039b54327df74396605410ea9abe19c8a4e7 (patch) | |
tree | c702564d17e0a490d56845027238eb4f231be785 /src/Main.elm | |
parent | 62fee9133f36f655c1ed83e0c2e85394f9948bf5 (diff) |
Upgrade to elm 0.17.1
Diffstat (limited to 'src/Main.elm')
-rw-r--r-- | src/Main.elm | 72 |
1 files changed, 25 insertions, 47 deletions
diff --git a/src/Main.elm b/src/Main.elm index 746df14..743c776 100644 --- a/src/Main.elm +++ b/src/Main.elm @@ -1,51 +1,29 @@ -module Main +port module Main exposing ( main - ) where + ) -import Signal -import Html exposing (Html) -import Time exposing (..) -import Mouse -import Json.Encode exposing (Value) -import Keyboard +import Html.App exposing (programWithFlags) +import Time import Char -import Dict -import List -import Keyboard exposing (KeyCode) -import Model.Model exposing (..) -import Model.Position exposing (..) -import Model.TimerState exposing (..) -import Model.Id exposing (..) -import Update.Update exposing (..) -import View.View exposing (view) - -main : Signal Html -main = Signal.map view model - -model : Signal Model -model = Signal.foldp logUpdate (initialModel initialTime) input - -input : Signal Action -input = - Signal.mergeMany - [ actions.signal - , Signal.map DeltaTime (fps 30) - , Signal.map KeyPressed keyPress - ] - -port ringingTimers : Signal Bool -port ringingTimers = - Signal.map - (\model -> - model.timers - |> Dict.toList - |> List.map snd - |> List.any (\timer -> timer.state == Ringing) - ) - model - |> Signal.dropRepeats - -port keyPress : Signal KeyCode - -port initialTime : Time +import Model exposing (init) +import Model.Keyboard exposing (KeyCode) +import Msg +import Update exposing (update) +import View exposing (view) + +main : Program Float +main = + programWithFlags + { init = init + , update = update + , subscriptions = (\model -> + Sub.batch + [ Time.every 40 Msg.Time + , keyPress Msg.KeyPressed + ] + ) + , view = view + } + +port keyPress : (KeyCode -> msg) -> Sub msg |