@qvant/qui-max
Version:
A Vue 3 Design system for Web.
21 lines (20 loc) • 628 B
JavaScript
import debounce from "./debounce.js";
import isObject from "./isObject.js";
var FUNC_ERROR_TEXT = "Expected a function";
function throttle(func, wait, options) {
var leading = true, trailing = true;
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (isObject(options)) {
leading = "leading" in options ? !!options.leading : leading;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
return debounce(func, wait, {
"leading": leading,
"maxWait": wait,
"trailing": trailing
});
}
export { throttle as default };
//# sourceMappingURL=throttle.js.map