MCPcopy Create free account
hub / github.com/Xu22Web/tech-study-js / debounce

Function debounce

tech-study.js:2481–2491  ·  view source on GitHub ↗

* @description 防抖 * @param callback * @param delay * @returns

(callback, delay)

Source from the content-addressed store, hash-verified

2479 * @returns
2480 */
2481function debounce(callback, delay) {
2482 let timer = -1;
2483 return function (...args) {
2484 if (timer !== -1) {
2485 clearTimeout(timer);
2486 }
2487 timer = setTimeout(() => {
2488 callback.apply(this, args);
2489 }, delay);
2490 };
2491}
2492/**
2493 * @description 判断是否为移动端
2494 * @returns

Callers 10

SelectFunction · 0.70
FrameFunction · 0.70
LoginItemFunction · 0.70
InfoItemFunction · 0.70
ScoreItemFunction · 0.70
TaskListFunction · 0.70
TaskBtnFunction · 0.70
ScheduleListFunction · 0.70
SettingsPanelFunction · 0.70
PanelFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected