Skip to content

Instantly share code, notes, and snippets.

@dperuo
Created January 12, 2024 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dperuo/7880f97b041b9d0c04ceb98d515e9b32 to your computer and use it in GitHub Desktop.
Save dperuo/7880f97b041b9d0c04ceb98d515e9b32 to your computer and use it in GitHub Desktop.
const { fromEvent, pipe } = Rx;
const { scan, throttleTime } = RxOperators;
const tick = () => scan(next => next + 1, 0);
const throttled = () => throttleTime(500);
const paced = () => pipe(throttled(), tick());
fromEvent(document, 'click').pipe(paced());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment