Files
SnowLuma/.pnpm-store/v11/files/1a/0fb086c9b2d4f2ca0a053e243ed492d282fa288f4e534d532e8cee9a70fada53a08678121568a621479dcdfde0f15a578253a2db04495d46c0a344f1d6b1c2
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

17 lines
682 B
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_SSE_KEEP_ALIVE_MS = void 0;
exports.armSseKeepAlive = armSseKeepAlive;
/** Default interval between SSE keep-alive comment frames. */
exports.DEFAULT_SSE_KEEP_ALIVE_MS = 15000;
const MAX_TIMER_DELAY_MS = 2 ** 31 - 1;
/** Arms an unref'd timer, or disables keep-alive for invalid delays. */
function armSseKeepAlive(intervalMs, onTick) {
if (!Number.isFinite(intervalMs) || intervalMs < 1) {
return undefined;
}
const timer = setInterval(onTick, Math.min(intervalMs, MAX_TIMER_DELAY_MS));
timer.unref?.();
return timer;
}
//# sourceMappingURL=sseKeepAlive.js.map