@easy-sync/batching
Version:
Batching library for easy-sync.
2 lines (1 loc) • 407 B
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function l(i,e){return(n,c,r)=>{if(e!==void 0&&r>=e)return 0;const o=Date.now()-n,t=i-o;return Math.max(0,t)}}function g(i,e,n){return(c,r,o)=>{if(n!==void 0&&o>=n)return 0;const t=Date.now(),u=t-r,a=t-c,d=e-a,s=i-u,m=Math.min(d,s);return Math.max(0,m)}}exports.createDebouncedScheduler=g;exports.createFixedWindowScheduler=l;