Skip to content

New module: debounce.js

Choose a tag to compare

@awangga awangga released this 11 Sep 22:15
· 86 commits to main since this release

Adds debounce.js:

  • debounce(fn, delay) - runs fn only after the caller stops triggering it, for search-as-you-type and similar input handling.
  • throttle(fn, delay) - runs fn at most once per interval, firing immediately and again at the end of the window so the last call's arguments are not lost. Useful for scroll, resize and mousemove.

Docs: https://croot.js.org/docs/debounce