Skip to content

Instantly share code, notes, and snippets.

@DanShappir
Created November 1, 2020 10:00
Show Gist options
  • Save DanShappir/a24f86a53c8adeff871d2d2e6c3602a4 to your computer and use it in GitHub Desktop.
Save DanShappir/a24f86a53c8adeff871d2d2e6c3602a4 to your computer and use it in GitHub Desktop.
Processing DOM events with pipeline operator
const myButton = document.getElementById("myButton");
fromEvent(myButton, "click")
|> reduce(#, acc => acc + 1, 0)
|> forEach(#, count => console.log(count));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment