* @description 防抖 * @param callback * @param delay * @returns
(callback, delay)
| 2479 | * @returns |
| 2480 | */ |
| 2481 | function 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 |
no outgoing calls
no test coverage detected