@runeya/runeya
Version:
Monitor processes as a stack
2 lines (1 loc) • 1.07 kB
JavaScript
import{g as h}from"./_commonjsHelpers-D6-XlEtG.js";var u={exports:{}},g;function x(){if(g)return u.exports;g=1;function l(s,i=100,c={}){if(typeof s!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof s}\`.`);if(i<0)throw new RangeError("`wait` must not be negative.");const{immediate:p}=typeof c=="boolean"?{immediate:c}:c;let o,f,e,m,n;function d(){const r=o,a=f;return o=void 0,f=void 0,n=s.apply(r,a),n}function b(){const r=Date.now()-m;r<i&&r>=0?e=setTimeout(b,i-r):(e=void 0,p||(n=d()))}const t=function(...r){if(o&&this!==o&&Object.getPrototypeOf(this)===Object.getPrototypeOf(o))throw new Error("Debounced method called with different contexts of the same prototype.");o=this,f=r,m=Date.now();const a=p&&!e;return e||(e=setTimeout(b,i)),a&&(n=d()),n};return Object.defineProperty(t,"isPending",{get(){return e!==void 0}}),t.clear=()=>{e&&(clearTimeout(e),e=void 0)},t.flush=()=>{e&&t.trigger()},t.trigger=()=>{n=d(),t.clear()},t}return u.exports.debounce=l,u.exports=l,u.exports}var y=x();const D=h(y);export{D as d};