( targetWindow: Window & typeof globalThis, fn: Function, ms: number, )
| 79 | export const approxEqual = (a: number, b: number) => Math.abs(a - b) < 1 |
| 80 | |
| 81 | export const debounce = ( |
| 82 | targetWindow: Window & typeof globalThis, |
| 83 | fn: Function, |
| 84 | ms: number, |
| 85 | ) => { |
| 86 | let timeoutId: number |
| 87 | return function (this: any, ...args: Array<any>) { |
| 88 | targetWindow.clearTimeout(timeoutId) |
| 89 | timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms) |
| 90 | } |
| 91 | } |
no outgoing calls
no test coverage detected