Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created April 3, 2016 06:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/32e21f2fc7abecf1994bfd4f13d60fae to your computer and use it in GitHub Desktop.
Save chuck0523/32e21f2fc7abecf1994bfd4f13d60fae to your computer and use it in GitHub Desktop.
module Counter (Model, init, Action, update, view, viewWithRemoveButton, Context) where
...
type alias Context =
{ actions : Signal.Address Action
, remove : Signal.Address ()
}
viewWithRemoveButton : Context -> Model -> Html
viewWithRemoveButton context model =
div []
[ button [ onClick context.actions Decrement ] [ text "-" ]
, div [ countStyle ] [ text (toString model) ]
, button [ onClick context.actions Increment ] [ text "+" ]
, div [ countStyle ] []
, button [ onClick context.remove () ] [ text "X" ]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment