Skip to content

Commit

Permalink
web: update time every minute
Browse files Browse the repository at this point in the history
  • Loading branch information
rlefevre committed Jul 25, 2019
1 parent 1835b96 commit 9099b75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions web/src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ type Msg
| RssUpdated (Result Xml.Errors Feed)
| SearchInputChanged String
| SearchRequested
| UpdateRequested Time.Posix
| TimeChanged Time.Posix
| UpdateRequested
| UrlChanged Url
| UrlRequested UrlRequest
| WindowResized Int Int
Expand Down Expand Up @@ -994,9 +995,12 @@ update msg model =
SearchRequested ->
( model, Nav.pushUrl model.navKey ("/last?_search=" ++ model.search) )

UpdateRequested now ->
TimeChanged now ->
( { model | now = now }, getRss model.url )

UpdateRequested ->
( model, getRss model.url )

UrlRequested urlRequest ->
case urlRequest of
Browser.Internal url ->
Expand Down Expand Up @@ -1038,7 +1042,8 @@ toggle id set =
subscriptions : Model -> Sub Msg
subscriptions model =
Sub.batch
[ Time.every (5 * 60 * 1000) UpdateRequested
[ Time.every (5 * 60 * 1000) (always UpdateRequested)
, Time.every (60 * 1000) TimeChanged
, Browser.Events.onResize WindowResized
]

Expand Down
2 changes: 1 addition & 1 deletion web/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro|Source+Sans+Pro:400,600,700&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="/spinner.62ccd50c.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js"></script>
<script src="/elm.2ded763f.js"></script>
<script src="/elm.28c34ead.js"></script>
</head>
<body>
<script>
Expand Down

0 comments on commit 9099b75

Please sign in to comment.