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/centrifuge.cjs
CHANGED
|
@@ -1174,6 +1174,9 @@ var DataBusTraceReporter = class {
|
|
|
1174
1174
|
metricsIntervalMs;
|
|
1175
1175
|
sink;
|
|
1176
1176
|
now;
|
|
1177
|
+
asyncSink;
|
|
1178
|
+
pendingEvents = [];
|
|
1179
|
+
sinkFlushScheduled = false;
|
|
1177
1180
|
intervalHandle = null;
|
|
1178
1181
|
intervalStartedAt = 0;
|
|
1179
1182
|
// A reporter may be flushed explicitly before start(), but once stop() is
|
|
@@ -1195,6 +1198,7 @@ var DataBusTraceReporter = class {
|
|
|
1195
1198
|
this.mode = options?.mode ?? "all";
|
|
1196
1199
|
this.metricsIntervalMs = normalizeInterval(options?.metricsIntervalMs);
|
|
1197
1200
|
this.sink = options?.sink ?? (() => void 0);
|
|
1201
|
+
this.asyncSink = options?.asyncSink ?? false;
|
|
1198
1202
|
this.now = now;
|
|
1199
1203
|
}
|
|
1200
1204
|
/** Start the periodic metrics flush interval. No-op when mode is 'events'
|
|
@@ -1321,6 +1325,22 @@ var DataBusTraceReporter = class {
|
|
|
1321
1325
|
this.dedupSuppressed = 0;
|
|
1322
1326
|
}
|
|
1323
1327
|
emit(event) {
|
|
1328
|
+
if (this.asyncSink) {
|
|
1329
|
+
this.pendingEvents.push(event);
|
|
1330
|
+
if (!this.sinkFlushScheduled) {
|
|
1331
|
+
this.sinkFlushScheduled = true;
|
|
1332
|
+
queueMicrotask(() => {
|
|
1333
|
+
this.sinkFlushScheduled = false;
|
|
1334
|
+
const events = this.pendingEvents;
|
|
1335
|
+
this.pendingEvents = [];
|
|
1336
|
+
for (const queued of events) this.emitSync(queued);
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
return;
|
|
1340
|
+
}
|
|
1341
|
+
this.emitSync(event);
|
|
1342
|
+
}
|
|
1343
|
+
emitSync(event) {
|
|
1324
1344
|
try {
|
|
1325
1345
|
this.sink(event);
|
|
1326
1346
|
} catch (error) {
|