MCPcopy Create free account
hub / github.com/subquery/subql / setAsyncInterval

Function setAsyncInterval

packages/query/src/utils/asyncInterval.ts:16–25  ·  view source on GitHub ↗
(cb: () => any, interval: number)

Source from the content-addressed store, hash-verified

14};
15
16export const setAsyncInterval = (cb: () => any, interval: number) => {
17 if (cb && typeof cb === 'function') {
18 const intervalIndex = asyncIntervals.length;
19 asyncIntervals.push({run: true, id: 0});
20 void runAsyncInterval(cb, interval, intervalIndex);
21 return intervalIndex;
22 } else {
23 throw new Error('Callback must be a function');
24 }
25};

Callers 1

Calls 1

runAsyncIntervalFunction · 0.85

Tested by

no test coverage detected