* Simple debounce implementation
(fn, delay)
| 33 | * Simple debounce implementation |
| 34 | */ |
| 35 | function debounce(fn, delay) { |
| 36 | let timer = null |
| 37 | return (...args) => { |
| 38 | if (timer) clearTimeout(timer) |
| 39 | timer = setTimeout(() => { |
| 40 | fn(...args) |
| 41 | }, delay) |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | let running = false |
| 46 |