fix(sdk): §4.5 红线补全(act/重放包裹)+ beacon-false 丢批计数 + 空闲负向测试 + es2020
- events.ts:act 回调与 visibilitychange 监听体包 try/catch(字面红线) - transport.ts:sendBeacon 返回 false(64KB 超限等)按批事件数计 dropped ——与 stringify 丢包计数对称的缺口 - index.ts:顶层队列重放双层包裹,单个坏条目只跳过自身不吞后续 init/track - 测试:30s 空闲负向(active_ms=29000 后停止)、beacon-false 丢批;44→46 - build.mjs target es2018→es2020(代码依赖 globalThis,目标诚实化) Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -49,10 +49,12 @@ export class Transport {
|
||||
events,
|
||||
});
|
||||
if (beacon && navigator.sendBeacon) {
|
||||
navigator.sendBeacon(
|
||||
// 返回 false=浏览器拒收(队列满/载荷超 64KB 等)→ 整批丢,须计 dropped
|
||||
const ok = navigator.sendBeacon(
|
||||
this.cfg.endpoint,
|
||||
new Blob([body], { type: "text/plain" })
|
||||
);
|
||||
if (!ok) this.dropped += n;
|
||||
return;
|
||||
}
|
||||
this.send(body, events.length);
|
||||
|
||||
Reference in New Issue
Block a user