(fn, ms = 0)
| 183 | |
| 184 | // copied from https://www.30secondsofcode.org/js/s/debounce |
| 185 | export const debounce = (fn, ms = 0) => { |
| 186 | let timeoutId; |
| 187 | return function(...args) { |
| 188 | clearTimeout(timeoutId); |
| 189 | timeoutId = setTimeout(() => fn.apply(this, args), ms); |
| 190 | }; |
| 191 | }; |
| 192 | |
| 193 | // copied from https://www.30secondsofcode.org/js/s/throttle |
| 194 | export const throttle = (fn, wait) => { |
no outgoing calls
no test coverage detected