Skip to content

Instantly share code, notes, and snippets.

@DanShappir
Created November 1, 2020 10:10
Show Gist options
  • Save DanShappir/780f67925cd6a6725882c550a74b1794 to your computer and use it in GitHub Desktop.
Save DanShappir/780f67925cd6a6725882c550a74b1794 to your computer and use it in GitHub Desktop.
Processing DOM events with pipe function
const myButton = document.getElementById("myButton");
pipe(
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