@slan-health/taro-vueuse
Version:
taro vue版本hooks
23 lines (22 loc) • 575 B
JavaScript
import { isObject } from "../index.js";
import debounce from "./debounce.js";
function throttle(func, wait, options) {
let leading = true;
let trailing = true;
if (typeof func !== "function") {
throw new TypeError("Expected a function");
}
if (isObject(options)) {
leading = "leading" in options ? !!options.leading : leading;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
return debounce(func, wait, {
leading,
trailing,
maxWait: wait
});
}
export {
throttle as default
};
//# sourceMappingURL=throttle.js.map