@openreplay/tracker 15.0.5-beta.1 → 15.0.6

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/dist/cjs/index.js CHANGED
@@ -4703,7 +4703,7 @@ class App {
4703
4703
  this.stopCallbacks = [];
4704
4704
  this.commitCallbacks = [];
4705
4705
  this.activityState = ActivityState.NotActive;
4706
- this.version = '15.0.5-beta.1'; // TODO: version compatability check inside each plugin.
4706
+ this.version = '15.0.6'; // TODO: version compatability check inside each plugin.
4707
4707
  this.socketMode = false;
4708
4708
  this.compressionThreshold = 24 * 1000;
4709
4709
  this.bc = null;
@@ -4974,7 +4974,7 @@ class App {
4974
4974
  this.canvasRecorder?.restartTracking();
4975
4975
  };
4976
4976
  this.flushBuffer = async (buffer) => {
4977
- return new Promise((res) => {
4977
+ return new Promise((res, reject) => {
4978
4978
  if (buffer.length === 0) {
4979
4979
  res(null);
4980
4980
  return;
@@ -4984,9 +4984,18 @@ class App {
4984
4984
  while (endIndex < buffer.length && buffer[endIndex][0] !== 0 /* MType.Timestamp */) {
4985
4985
  endIndex++;
4986
4986
  }
4987
- const messagesBatch = buffer.splice(0, endIndex);
4988
- this.postToWorker(messagesBatch);
4989
- res(null);
4987
+ requestIdleCb(() => {
4988
+ try {
4989
+ const messagesBatch = buffer.splice(0, endIndex);
4990
+ // Cast out the proxy object to a regular array.
4991
+ this.postToWorker(messagesBatch.map((x) => [...x]));
4992
+ res(null);
4993
+ }
4994
+ catch (e) {
4995
+ this._debug('flushBuffer', e);
4996
+ reject(new Error('flush buffer fail'));
4997
+ }
4998
+ });
4990
4999
  });
4991
5000
  };
4992
5001
  this.onUxtCb = [];
@@ -9156,7 +9165,7 @@ class API {
9156
9165
  this.signalStartIssue = (reason, missingApi) => {
9157
9166
  const doNotTrack = this.checkDoNotTrack();
9158
9167
  console.log("Tracker couldn't start due to:", JSON.stringify({
9159
- trackerVersion: '15.0.5-beta.1',
9168
+ trackerVersion: '15.0.6',
9160
9169
  projectKey: this.options.projectKey,
9161
9170
  doNotTrack,
9162
9171
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,