@nethesis/phone-island
Version:
NethVoice CTI Phone Island
3 lines (2 loc) • 1.14 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./isObject.js"),e=require("./now.js"),r=require("./toNumber.js"),i=t.default,n=e.default,u=r.default,o=Math.max,a=Math.min;var f=function(t,e,r){var f,c,v,d,s,l,m=0,p=!1,T=!1,x=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function h(e){var r=f,i=c;return f=c=void 0,m=e,d=t.apply(i,r)}function j(t){var r=t-l;return void 0===l||r>=e||r<0||T&&t-m>=v}function y(){var t=n();if(j(t))return b(t);s=setTimeout(y,function(t){var r=e-(t-l);return T?a(r,v-(t-m)):r}(t))}function b(t){return s=void 0,x&&f?h(t):(f=c=void 0,d)}function g(){var t=n(),r=j(t);if(f=arguments,c=this,l=t,r){if(void 0===s)return function(t){return m=t,s=setTimeout(y,e),p?h(t):d}(l);if(T)return clearTimeout(s),s=setTimeout(y,e),h(l)}return void 0===s&&(s=setTimeout(y,e)),d}return e=u(e)||0,i(r)&&(p=!!r.leading,v=(T="maxWait"in r)?o(u(r.maxWait)||0,e):v,x="trailing"in r?!!r.trailing:x),g.cancel=function(){void 0!==s&&clearTimeout(s),m=0,f=l=c=s=void 0},g.flush=function(){return void 0===s?d:b(n())},g};exports.default=f;
//# sourceMappingURL=debounce.js.map