UNPKG

amos-tool

Version:

amos ui tool

29 lines (26 loc) 699 B
"use strict"; function throttle(t, o, e, n) { var i, u = !1, c = 0; function r() { i && clearTimeout(i); } function l() { var l = this, d = Date.now() - c, a = arguments; function f() { c = Date.now(), e.apply(l, a); } u || (n && !i && f(), r(), void 0 === n && d > t ? f() : !0 !== o && (i = setTimeout(n ? function() { i = void 0; } : f, void 0 === n ? t - d : t))); } return "boolean" != typeof o && (n = e, e = o, o = void 0), l.cancel = function() { r(), u = !0; }, l; } function debounce(t, o, e) { return void 0 === e ? throttle(t, o, !1) : throttle(t, e, !1 !== o); } module.exports = { throttle: throttle, debounce: debounce };