about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2017-12-20T20·17+0100
committerVincent Ambo <tazjin@gmail.com>2017-12-20T20·17+0100
commitd3ce3c1568fdc2a0d7699c09098159814e02750c (patch)
tree22b57aa867ad7490f54d915c98f9e2e90e2c077d
parent7dbeb83f854de51e7997378fe1df840805fb73ee (diff)
feat(elm): Automatically poll every 15 seconds
15 seconds is potentially a bit aggressive considering that
Gemma (currently) tracks expiry times in *days*.
-rw-r--r--frontend/Main.elm14
1 files changed, 13 insertions, 1 deletions
diff --git a/frontend/Main.elm b/frontend/Main.elm
index c7dcc9dd898e..2ff61fe28f75 100644
--- a/frontend/Main.elm
+++ b/frontend/Main.elm
@@ -4,6 +4,7 @@ import Html exposing (Html, text, div, span)
 import Html.Attributes exposing (style)
 import Json.Decode exposing (..)
 import Http
+import Time
 
 
 --  Material design imports
@@ -182,6 +183,17 @@ view model =
     gemmaView model |> Scheme.top
 
 
+
+-- subscriptions : Model -> Sub Msg
+
+
+subscriptions model =
+    Sub.batch
+        [ Material.subscriptions Mdl model
+        , Time.every (15 * Time.second) (\_ -> LoadTasks)
+        ]
+
+
 main : Program Never Model Msg
 main =
     let
@@ -195,5 +207,5 @@ main =
             { init = ( model, Cmd.batch [ loadTasks, Material.init Mdl ] )
             , view = view
             , update = update
-            , subscriptions = Material.subscriptions Mdl
+            , subscriptions = subscriptions
             }