UNPKG

@dartbot/dartboard

Version:

Dartboard implemented as a vanilla web component

24 lines 611 B
export const throttle = (func, delay) => { let timerFlag = null; return (...args) => { if (timerFlag === null) { func(...args); timerFlag = setTimeout(() => { timerFlag = null; }, delay); } }; }; export const throttleAnimation = (func) => { let isFiring = false; return (...args) => { if (isFiring === false) { requestAnimationFrame(() => { func(...args); isFiring = false; }); } isFiring = true; }; }; //# sourceMappingURL=throttle.js.map