feat(elm): Automatically poll every 15 seconds

15 seconds is potentially a bit aggressive considering that
Gemma (currently) tracks expiry times in *days*.
This commit is contained in:
Vincent Ambo 2017-12-20 21:17:57 +01:00
parent 7dbeb83f85
commit d3ce3c1568

View file

@ -4,6 +4,7 @@ import Html exposing (Html, text, div, span)
import Html.Attributes exposing (style) import Html.Attributes exposing (style)
import Json.Decode exposing (..) import Json.Decode exposing (..)
import Http import Http
import Time
-- Material design imports -- Material design imports
@ -182,6 +183,17 @@ view model =
gemmaView model |> Scheme.top 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 : Program Never Model Msg
main = main =
let let
@ -195,5 +207,5 @@ main =
{ init = ( model, Cmd.batch [ loadTasks, Material.init Mdl ] ) { init = ( model, Cmd.batch [ loadTasks, Material.init Mdl ] )
, view = view , view = view
, update = update , update = update
, subscriptions = Material.subscriptions Mdl , subscriptions = subscriptions
} }