(key: string, fn: () => void, delayMs: number)
| 1 | const timerMap: { [key: string | number]: NodeJS.Timeout | number | undefined } = {}; |
| 2 | export const timeoutExecution = (key: string, fn: () => void, delayMs: number) => { |
| 3 | if (timerMap[key]) { |
| 4 | clearTimeout(timerMap[key]); |
| 5 | timerMap[key] = 0; |
| 6 | } |
| 7 | timerMap[key] = setTimeout(fn, delayMs); |
| 8 | }; |
| 9 | export const intervalExecution = ( |
| 10 | key: string, |
| 11 | fn: (firstExecute?: boolean) => void, |
no outgoing calls
no test coverage detected