(args, now = Date.now())
| 11 | let timer; |
| 12 | |
| 13 | const invoke = (args, now = Date.now()) => { |
| 14 | timestamp = now; |
| 15 | lastArgs = null; |
| 16 | if (timer) { |
| 17 | clearTimeout(timer); |
| 18 | timer = null; |
| 19 | } |
| 20 | fn(...args); |
| 21 | }; |
| 22 | |
| 23 | const throttled = (...args) => { |
| 24 | const now = Date.now(); |