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

Function timeoutExecution

src/pkg/utils/timer.ts:2–8  ·  view source on GitHub ↗
(key: string, fn: () => void, delayMs: number)

Source from the content-addressed store, hash-verified

1const timerMap: { [key: string | number]: NodeJS.Timeout | number | undefined } = {};
2export 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};
9export const intervalExecution = (
10 key: string,
11 fn: (firstExecute?: boolean) => void,

Callers 2

initAsyncFunction · 0.90
updateBadgeIconMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected