Files
SBPanel-Backend/frontend/admin/node_modules/element-plus/es/utils/throttleByRaf.mjs
CN-JS-HuiBai db7f1ba82f
Some checks failed
build / build (api, amd64, linux) (push) Failing after -51s
build / build (api, arm64, linux) (push) Failing after -52s
build / build (api.exe, amd64, windows) (push) Failing after -51s
使用VUE重构项目
2026-04-20 00:19:11 +08:00

22 lines
412 B
JavaScript

import { cAF, rAF } from "./raf.mjs";
//#region ../../packages/utils/throttleByRaf.ts
function throttleByRaf(cb) {
let timer = 0;
const throttle = (...args) => {
if (timer) cAF(timer);
timer = rAF(() => {
cb(...args);
timer = 0;
});
};
throttle.cancel = () => {
cAF(timer);
timer = 0;
};
return throttle;
}
//#endregion
export { throttleByRaf };
//# sourceMappingURL=throttleByRaf.mjs.map