@wordpress/compose
Version:
WordPress higher-order components (HOCs).
20 lines (19 loc) • 475 B
JavaScript
// packages/compose/src/utils/throttle/index.ts
import { debounce } from "../debounce";
var throttle = (func, wait, options) => {
let leading = true;
let trailing = true;
if (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
};
//# sourceMappingURL=index.js.map