feat: 添加共享 Kiro 超时模块并更新相关文件以使用统一的页面加载超时预算

This commit is contained in:
QLHazyCoder
2026-05-19 00:09:20 +08:00
parent 6c664ca5bc
commit e197d1e726
9 changed files with 195 additions and 29 deletions
+25
View File
@@ -0,0 +1,25 @@
(function attachKiroTimeouts(root, factory) {
root.MultiPageKiroTimeouts = factory();
})(typeof self !== 'undefined' ? self : globalThis, function createKiroTimeoutsModule() {
const DEFAULT_KIRO_PAGE_LOAD_TIMEOUT_MS = 3 * 60 * 1000;
function normalizePositiveInteger(value, fallback) {
const numeric = Math.floor(Number(value));
if (Number.isInteger(numeric) && numeric > 0) {
return numeric;
}
return fallback;
}
function normalizeKiroPageLoadTimeoutMs(value, fallback = DEFAULT_KIRO_PAGE_LOAD_TIMEOUT_MS) {
return normalizePositiveInteger(
value,
normalizePositiveInteger(fallback, DEFAULT_KIRO_PAGE_LOAD_TIMEOUT_MS)
);
}
return {
DEFAULT_KIRO_PAGE_LOAD_TIMEOUT_MS,
normalizeKiroPageLoadTimeoutMs,
};
});