Update: I've found the following function to be useful when implementing smart event listeners.
fromMaybe : Maybe a -> JD.Decoder a fromMaybe ma = case ma of Just a -> JD.succeed a Nothing -> JD.fail "ignored"
Then, onVolumeInput becomes
onVolumeInput
onVolumeInput : (Volume -> msg) -> H.Attribute msg onVolumeInput onVolume = HE.targetValue |> JD.andThen (Volume.fromString >> Maybe.map onVolume >> JD.fromMaybe) |> HE.on "input"
See this commit for a full example.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Update: I've found the following function to be useful when implementing smart event listeners.
Then,
onVolumeInputbecomesSee this commit for a full example.