MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / ready

Function ready

packages/vite/hmr/client/index.ts:507–524  ·  view source on GitHub ↗
(ms = 8000, step = 60)

Source from the content-addressed store, hash-verified

505 const isAndroid = !!(App && (App as any).android !== undefined);
506 if (isAndroid) {
507 const ready = async (ms = 8000, step = 60) => {
508 const start = Date.now();
509 const ok = () => {
510 try {
511 const a = (App as any).android;
512 const act = a && (a.foregroundActivity || a.startActivity);
513 const inProg = !!g.__NS_DEV_RESET_IN_PROGRESS__;
514 return !!act && !inProg;
515 } catch {
516 return false;
517 }
518 };
519 while (Date.now() - start < ms) {
520 if (ok()) return true;
521 await new Promise((r) => setTimeout(r, step));
522 }
523 return ok();
524 };
525 const ok = await ready(8000, 60);
526 if (!ok && VERBOSE) console.warn('[hmr][init] proceeding without explicit boot-ready signal (timeout)');
527 }

Callers 1

applyFullGraphFunction · 0.85

Calls 2

okFunction · 0.85
setTimeoutFunction · 0.50

Tested by

no test coverage detected