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:
parent
7dbeb83f85
commit
d3ce3c1568
1 changed files with 13 additions and 1 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue