(func, limit)
| 582 | } |
| 583 | |
| 584 | function throttle(func, limit) { |
| 585 | let inThrottle; |
| 586 | return function executedFunction(...args) { |
| 587 | if (!inThrottle) { |
| 588 | func(...args); |
| 589 | inThrottle = true; |
| 590 | setTimeout(() => inThrottle = false, limit); |
| 591 | } |
| 592 | }; |
| 593 | } |
| 594 | |
| 595 | // ============================================ |
| 596 | // 格式化工具 |
nothing calls this directly
no outgoing calls
no test coverage detected