import { setImmediate as waitForImmediate } from "node:timers/promises";
/**
 * Yield to the macrotask queue so terminal input, timers, and render work can
 * run between otherwise synchronous startup chunks.
 */
export async function yieldToEventLoop() {
    await waitForImmediate();
}
export async function yieldToEventLoopIfSlow(startedAt, thresholdMs = 16) {
    if (Date.now() - startedAt >= thresholdMs) {
        await yieldToEventLoop();
    }
}
//# sourceMappingURL=event-loop.js.map