LendAndRegret/node_modules/es-toolkit/dist/compat/function/throttle.mjs
2026-05-02 17:27:43 +08:00

13 lines
293 B
JavaScript

import { debounce } from './debounce.mjs';
function throttle(func, throttleMs = 0, options = {}) {
const { leading = true, trailing = true } = options;
return debounce(func, throttleMs, {
leading,
maxWait: throttleMs,
trailing,
});
}
export { throttle };