UNPKG

quasar-framework

Version:

Build responsive SPA, SSR, PWA, Hybrid Mobile Apps and Electron apps, all simultaneously using the same codebase

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 }