Collection of great elm solutions and examples shared in ellie. The elli code is of course not my code, it's an collection of ellies shared by others.
https://ellie-app.com/4JY5PFRWYW3a1
This solutions is mostly based on CSS and the best solution to automatically add and remove rows, based on the user input.
https://ellie-app.com/6ZJ2tQ8FnbNa1
No need for a model etc.
https://ellie-app.com/7nVDGRBQr8ka1
case Decode.decodeValue decoder (Debug.log "log message:" value) of
Great example, especially because random types are generated
https://ellie-app.com/7TPZYfJnb74a1
|> Decode.andThen (\type_ ->
case type_ of
1 -> onePassStreamDecode
2 -> twoPassStreamDecode
_ -> Decode.fail "Unknown passCount"
)
or https://ellie-app.com/7V5sBcndPBka1
addEventListener("keydown",console.log);
https://ellie-app.com/83zVNwRMF3va1
https://pd-andy.github.io/elm-record-helpers/
Chaining debug logs into a piping
value
|> f
|> Debug.log "f"
|> g
|> Debug.log "g"
The event object is what you have at hand you define a custom "on" event. it's a json you can parse in what ever way you want. To see what this element contains and it's structured you can log the object in the console like this:
document.querySelector("SELECTOR").addEventListener("click", function(e){
console.log(e)
});
You don't have to decode a data attribute or id or so you can hardcode the msg content, e.g.:
on "animationend"
<| Decode.succeed
<| BrowserFinishedAnimation
<| String.fromInt i
tupleDecoder =
Decode.map2 (\first second -> (first, second))
(Decode.index 0 Decode.int)
(Decode.index 1 Decode.int)```