Skip to content

Instantly share code, notes, and snippets.

@rhizoome
Created August 19, 2018 19:33
Show Gist options
  • Save rhizoome/291c44c91b1a831b8e9afa802c4ec5a2 to your computer and use it in GitHub Desktop.
Save rhizoome/291c44c91b1a831b8e9afa802c4ec5a2 to your computer and use it in GitHub Desktop.
-- Read more about this program in the official Elm guide:
-- https://guide.elm-lang.org/architecture/user_input/buttons.html
import Html exposing (beginnerProgram, div, button, text, audio)
import Html.Events exposing (onClick)
import Html.Attributes exposing (src, autoplay)
main =
beginnerProgram { model = model, view = view, update = update }
-- MODEL
model = "huhu"
-- UPDATE
type Msg = Increment | Decrement
update msg model =
case msg of
Increment ->
"hehe"
Decrement ->
"https://1042.ch/42/ganwell/music/Fly%20Away.mp3"
-- VIEW
view model =
div []
[ button [ onClick Decrement ] [ text "-" ]
, div [] [ audio [src model, autoplay True] [] ]
, button [ onClick Increment ] [ text "+" ]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment