Skip to content

Instantly share code, notes, and snippets.

@doppioslash
Last active May 10, 2016 18:47
Show Gist options
  • Save doppioslash/9650d25ac27282b56036b87a8fa433e6 to your computer and use it in GitHub Desktop.
Save doppioslash/9650d25ac27282b56036b87a8fa433e6 to your computer and use it in GitHub Desktop.
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