forked from twopoint718/elmchat
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Main.elm
33 lines (26 loc) · 647 Bytes
/
Main.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
module Main exposing (main)
import Html
import Time exposing (second, every)
import Model exposing (Chat, model)
import Update exposing (update)
import View exposing (view)
import Messages exposing (Msg(PollMessages))
import Task
init : (Chat, Cmd Msg)
init = (model, prefetchMessages)
prefetchMessages : Cmd Msg
prefetchMessages =
Task.perform
(always PollMessages)
(Task.succeed ())
subscriptions : Chat -> Sub Msg
subscriptions _ =
every (5 * second) (always PollMessages)
main : Program Never Chat Msg
main =
Html.program
{ init = init
, update = update
, view = view
, subscriptions = subscriptions
}