UNPKG

quasar

Version:

Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time

21 lines (16 loc) 344 B
export default function (fn) { let wait = false, frame function debounced (...args) { if (wait) { return } wait = true frame = requestAnimationFrame(() => { fn.apply(this, args) wait = false }) } debounced.cancel = () => { window.cancelAnimationFrame(frame) wait = false } return debounced }