feat: 添加共享 Kiro 超时模块并更新相关文件以使用统一的页面加载超时预算
This commit is contained in:
@@ -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,
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user