cross-tab-worker-databus 0.20.63 → 0.20.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/centrifuge.js +1 -1
- package/dist/{chunk-ZHCGYGL3.js → chunk-5CP7GNU6.js} +21 -1
- package/dist/{chunk-ZHCGYGL3.js.map → chunk-5CP7GNU6.js.map} +2 -2
- package/dist/cjs/centrifuge.cjs +20 -0
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/index.cjs +20 -0
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/core/trace.d.ts +6 -0
- package/dist/core/trace.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/docs/roadmap.md +5 -1
- package/docs/zh/roadmap.md +5 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1199,6 +1199,9 @@ var DataBusTraceReporter = class {
|
|
|
1199
1199
|
metricsIntervalMs;
|
|
1200
1200
|
sink;
|
|
1201
1201
|
now;
|
|
1202
|
+
asyncSink;
|
|
1203
|
+
pendingEvents = [];
|
|
1204
|
+
sinkFlushScheduled = false;
|
|
1202
1205
|
intervalHandle = null;
|
|
1203
1206
|
intervalStartedAt = 0;
|
|
1204
1207
|
// A reporter may be flushed explicitly before start(), but once stop() is
|
|
@@ -1220,6 +1223,7 @@ var DataBusTraceReporter = class {
|
|
|
1220
1223
|
this.mode = options?.mode ?? "all";
|
|
1221
1224
|
this.metricsIntervalMs = normalizeInterval(options?.metricsIntervalMs);
|
|
1222
1225
|
this.sink = options?.sink ?? (() => void 0);
|
|
1226
|
+
this.asyncSink = options?.asyncSink ?? false;
|
|
1223
1227
|
this.now = now;
|
|
1224
1228
|
}
|
|
1225
1229
|
/** Start the periodic metrics flush interval. No-op when mode is 'events'
|
|
@@ -1346,6 +1350,22 @@ var DataBusTraceReporter = class {
|
|
|
1346
1350
|
this.dedupSuppressed = 0;
|
|
1347
1351
|
}
|
|
1348
1352
|
emit(event) {
|
|
1353
|
+
if (this.asyncSink) {
|
|
1354
|
+
this.pendingEvents.push(event);
|
|
1355
|
+
if (!this.sinkFlushScheduled) {
|
|
1356
|
+
this.sinkFlushScheduled = true;
|
|
1357
|
+
queueMicrotask(() => {
|
|
1358
|
+
this.sinkFlushScheduled = false;
|
|
1359
|
+
const events = this.pendingEvents;
|
|
1360
|
+
this.pendingEvents = [];
|
|
1361
|
+
for (const queued of events) this.emitSync(queued);
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
return;
|
|
1365
|
+
}
|
|
1366
|
+
this.emitSync(event);
|
|
1367
|
+
}
|
|
1368
|
+
emitSync(event) {
|
|
1349
1369
|
try {
|
|
1350
1370
|
this.sink(event);
|
|
1351
1371
|
} catch (error) {
|