aboutsummaryrefslogtreecommitdiff
path: root/src/Update/UpdateTimer.elm
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-03-18 00:32:17 +0100
committerJoris Guyonvarch2015-03-18 00:32:17 +0100
commit2613aeeae0f4de44842ff0e796603d0316a61a14 (patch)
tree722a21c69597e6d2547ad9f991e7c73afae78058 /src/Update/UpdateTimer.elm
parent0075abf51db5d1b54117525d7a7f9b06e31c9484 (diff)
Can edit the time, unfortunately the enter key is overriden so the '+' key of the numpad is used instead
Diffstat (limited to 'src/Update/UpdateTimer.elm')
-rw-r--r--src/Update/UpdateTimer.elm18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/Update/UpdateTimer.elm b/src/Update/UpdateTimer.elm
index 3eba549..e4671d9 100644
--- a/src/Update/UpdateTimer.elm
+++ b/src/Update/UpdateTimer.elm
@@ -3,26 +3,40 @@ module Update.UpdateTimer
, updateTimer
) where
+import Time (Time)
+
import Model.Timer (..)
import Model.Id (..)
type TimerAction =
Restart
+ | Pause
| ToggleRunning
| Stop
+ | SetTime Time
updateTimer : TimerAction -> Timer -> Timer
updateTimer action timer =
case action of
- ToggleRunning ->
- { timer | isRunning <- timer.currentTime > 0.0 && not timer.isRunning }
Restart ->
{ timer
| isRunning <- True
, currentTime <- initTime timer.initialTime
}
+ Pause ->
+ { timer
+ | isRunning <- False
+ }
+ ToggleRunning ->
+ { timer | isRunning <- timer.currentTime > 0.0 && not timer.isRunning }
Stop ->
{ timer
| isRunning <- False
, currentTime <- initTime timer.initialTime
}
+ SetTime time ->
+ let augmentedTime = time + 999
+ in { timer
+ | initialTime <- augmentedTime
+ , currentTime <- augmentedTime
+ }