MCPcopy Create free account
hub / github.com/scriptscat/scriptcat / intervalExecution

Function intervalExecution

src/pkg/utils/timer.ts:9–21  ·  view source on GitHub ↗
(
  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};
9export 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};

Callers 1

initAsyncFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected