@highlight-run/rrweb 2.0.0-lambda.1 → 2.0.0-lambda.3

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.
@@ -1,4 +1,16 @@
1
- (function (g, f) {if ("object" == typeof exports && "object" == typeof module) {module.exports = f();} else if ("function" == typeof define && define.amd) {define("rrweb", [], f);} else if ("object" == typeof exports) {exports["rrweb"] = f();} else {g["rrweb"] = f();}}(typeof self !== 'undefined' ? self : typeof globalThis !== 'undefined' ? globalThis : this, () => {var exports = {};var module = { exports };
1
+ (function (g, f) {
2
+ if ("object" == typeof exports && "object" == typeof module) {
3
+ module.exports = f();
4
+ } else if ("function" == typeof define && define.amd) {
5
+ define("rrweb", [], f);
6
+ } else if ("object" == typeof exports) {
7
+ exports["rrweb"] = f();
8
+ } else {
9
+ g["rrweb"] = f();
10
+ }
11
+ }(this, () => {
12
+ var exports = {};
13
+ var module = { exports };
2
14
  "use strict";
3
15
  var __defProp = Object.defineProperty;
4
16
  var __defProps = Object.defineProperties;
@@ -15011,8 +15023,12 @@ class Timer {
15011
15023
  this.actions = this.actions.concat(actions);
15012
15024
  }
15013
15025
  replaceActions(actions) {
15026
+ const rafWasActive = this.raf === true;
15014
15027
  this.actions.length = 0;
15015
- this.actions.splice(0, 0, ...actions);
15028
+ this.actions = [...actions];
15029
+ if (rafWasActive) {
15030
+ this.raf = requestAnimationFrame(this.rafCheck.bind(this));
15031
+ }
15016
15032
  }
15017
15033
  /* End Highlight Code */
15018
15034
  start() {
@@ -15379,28 +15395,26 @@ function createPlayerService(context, { getCastFn, applyEventsSynchronously, emi
15379
15395
  }),
15380
15396
  /* Highlight Code Start */
15381
15397
  replaceEvents: o((ctx, machineEvent) => {
15398
+ if (machineEvent.type !== "REPLACE_EVENTS") return ctx;
15382
15399
  const { events: curEvents, timer, baselineTime } = ctx;
15383
- if (machineEvent.type === "REPLACE_EVENTS") {
15384
- const { events: newEvents } = machineEvent.payload;
15385
- curEvents.length = 0;
15386
- const actions = [];
15387
- for (const event of newEvents) {
15388
- addDelay(event, baselineTime);
15389
- curEvents.push(event);
15390
- if (event.timestamp >= timer.timeOffset + baselineTime) {
15391
- const castFn = getCastFn(event, false);
15392
- actions.push({
15393
- doAction: () => {
15394
- castFn();
15395
- },
15396
- delay: event.delay
15397
- });
15398
- }
15399
- }
15400
- if (timer.isActive()) {
15401
- timer.replaceActions(actions);
15400
+ const { events: newEvents } = machineEvent.payload;
15401
+ if (newEvents.length === 0) return ctx;
15402
+ curEvents.length = 0;
15403
+ const actions = [];
15404
+ const timeThreshold = timer.timeOffset + baselineTime;
15405
+ for (const event of newEvents) {
15406
+ addDelay(event, baselineTime);
15407
+ curEvents.push(event);
15408
+ if (event.timestamp >= timeThreshold) {
15409
+ actions.push({
15410
+ doAction: getCastFn(event, false),
15411
+ delay: event.delay
15412
+ });
15402
15413
  }
15403
15414
  }
15415
+ if (timer.isActive()) {
15416
+ timer.replaceActions(actions);
15417
+ }
15404
15418
  return __spreadProps(__spreadValues({}, ctx), { events: curEvents });
15405
15419
  }),
15406
15420
  /* Highlight Code End */
@@ -17790,7 +17804,7 @@ exports.freezePage = freezePage;
17790
17804
  exports.record = record;
17791
17805
  exports.takeFullSnapshot = takeFullSnapshot;
17792
17806
  exports.utils = utils;
17793
- ;if (typeof module.exports == "object" && typeof exports == "object") {
17807
+ if (typeof module.exports == "object" && typeof exports == "object") {
17794
17808
  var __cp = (to, from, except, desc) => {
17795
17809
  if ((from && typeof from === "object") || typeof from === "function") {
17796
17810
  for (let key of Object.getOwnPropertyNames(from)) {