MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / generationDelay

Function generationDelay

pmcaptcha/pmcaptcha.ts:228–235  ·  view source on GitHub ↗
(ms: number)

Source from the content-addressed store, hash-verified

226 return await new Promise<boolean>((resolve) => {
227 lifecycle.setTimeout(() => resolve(!lifecycle.signal.aborted), ms, { label: "pmcaptcha-delay" });
228 if (lifecycle.signal.aborted) resolve(false);
229 });
230}
231
232async function waitDb(ms = 5000): Promise<boolean> {
233 const t = Date.now();
234 while (!dbReady && Date.now() - t < ms) {
235 if (!(await generationDelay(50))) return false;
236 }
237 return dbReady;
238}

Callers 2

waitDbFunction · 0.85
tryGetCanvasFunction · 0.85

Calls 1

getActiveLifecycleFunction · 0.85

Tested by

no test coverage detected