From d3ce3c1568fdc2a0d7699c09098159814e02750c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 20 Dec 2017 21:17:57 +0100 Subject: [PATCH] feat(elm): Automatically poll every 15 seconds 15 seconds is potentially a bit aggressive considering that Gemma (currently) tracks expiry times in *days*. --- frontend/Main.elm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/Main.elm b/frontend/Main.elm index c7dcc9dd8..2ff61fe28 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 }