Function
intervalExecution
(
key: string,
fn: (firstExecute?: boolean) => void,
delayMs: number,
executeNow: boolean = false
)
Source from the content-addressed store, hash-verified
| 7 | timerMap[key] = setTimeout(fn, delayMs); |
| 8 | }; |
| 9 | export const intervalExecution = ( |
| 10 | key: string, |
| 11 | fn: (firstExecute?: boolean) => void, |
| 12 | delayMs: number, |
| 13 | executeNow: boolean = false |
| 14 | ) => { |
| 15 | if (timerMap[key]) { |
| 16 | clearInterval(timerMap[key]); |
| 17 | timerMap[key] = 0; |
| 18 | } |
| 19 | timerMap[key] = setInterval(fn, delayMs); |
| 20 | if (executeNow) fn(true); |
| 21 | }; |
Tested by
no test coverage detected