Created
August 19, 2018 19:33
-
-
Save rhizoome/291c44c91b1a831b8e9afa802c4ec5a2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
-- 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