UNPKG

dk-plus

Version:
13 lines (12 loc) 259 B
function n(l, o) { let i = null, e = 0; return (...r) => { const t = Date.now(); !e || t - e >= o ? (e = t, l(...r)) : (i && clearTimeout(i), i = setTimeout(() => { e = t, l(...r); }, o - (t - e))); }; } export { n as getThrottle };