fix(sdk): stayIntervalMs边界守卫——0/NaN钳制下限防事件灌入
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
+3
-1
@@ -24,7 +24,9 @@ export interface StayOptions {
|
||||
}
|
||||
|
||||
export function startStayTracking(t: Transport, ps: PageSession, opts: StayOptions = {}): void {
|
||||
const stayIntervalMs = opts.stayIntervalMs ?? 15_000;
|
||||
// 边界守卫:0/负数等有限小值钳制下限 1s(防 setInterval 高频 cut 灌入事件);
|
||||
// NaN/Infinity 非有限值——NaN 绕过 ?? 的 nullish 判定直传,须显式回落默认 15s。
|
||||
const stayIntervalMs = Math.max(1_000, Number.isFinite(opts.stayIntervalMs) ? opts.stayIntervalMs! : 15_000);
|
||||
let intervalStart: number | null = null; // performance.now 基准;null=无 open 区间
|
||||
let lastCutEnd: number | null = null; // 最近一次 cut 的 perf 端点——重开回溯的钳制上界
|
||||
let lastAct = Date.now(); // 墙钟活动戳(沿 events.ts 冻结语义;页面加载即活动)
|
||||
|
||||
Reference in New Issue
Block a user