feat: huaxing-AI智能BAS系统

This commit is contained in:
xuziqiang
2024-05-21 16:42:16 +08:00
parent 84ef5b6032
commit 4a9b924df6
63 changed files with 32555 additions and 16 deletions

View File

@@ -0,0 +1,21 @@
export function debounce(_this: any, fn: (arg0: any) => void) {
// 用rAF去做防抖
return function (...args: any) {
if (_this.lock) return;
const run = function () {
// requestIdleCallback-任务调度
window.requestIdleCallback(function (deadline) {
_this.lock = true;
// 判断空闲时间
// 显示器刷新频率HZ 16.7ms内不会重复执行
if (deadline.timeRemaining() > 1000 / 60) {
fn(...args);
_this.lock = false;
} else {
run();
}
});
};
run();
};
}