fetchlet 0.1.0

Rust-hosted JavaScript functions and Fetch handlers with explicit host services
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
// Generated by `vp run build:scripts` from the TypeScript sources in js-src/.
// js-src/event-loop.ts
(() => {
	globalThis.__fetchletAsyncContext?.set(void 0);
	globalThis.__fetchletFlushRejections?.();
	const completedFetches = globalThis.__fetchletPumpHost?.() ?? 0;
	const timerFired = globalThis.__fetchletRunNextTimer?.() ?? false;
	const delay = globalThis.__fetchletTimerDelay?.();
	return JSON.stringify({
		progress: completedFetches > 0 || timerFired === true,
		delay: typeof delay === "number" && Number.isFinite(delay) && delay >= 0 ? Math.ceil(delay) : null
	});
})();