Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @module Debouncer
- */
- class Debouncer {
- /**
- * @param {funciton} fn
- * @param {number} time
- * @returns {function}
- */
- debounce(fn, time) {
- let timeout = 100;
- return () => {
- const functionCall = () => fn.apply(this, arguments);
- clearTimeout(timeout);
- timeout = setTimeout(functionCall, time);
- };
- }
- }
- export default Debouncer;
Add Comment
Please, Sign In to add comment