Last active
May 10, 2016 18:47
-
-
Save doppioslash/9650d25ac27282b56036b87a8fa433e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Html exposing (..) | |
import Html.App as Html | |
import Time exposing (Time, second) | |
import Html.Events exposing (..) | |
main = | |
Html.program | |
{ init = init | |
, update = update | |
, view = view | |
, subscriptions = subs | |
} | |
type alias Model = Time | |
type Msg | |
= Tick Time | |
| Clicked | |
init : (Model, Cmd Msg) | |
init = (0, Cmd.none) | |
update : Msg -> Model -> (Model, Cmd Msg) | |
update msg model = | |
case msg of | |
Tick time -> | |
(time, Cmd.none) | |
Clicked -> | |
(0, Cmd.none) | |
view : Model -> Html Msg | |
view model = | |
div [] [text (toString model) | |
, button [onClick Clicked] [text "button"] | |
] | |
subs : Model -> Sub Msg | |
subs model = | |
Time.every second Tick |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment