@glimt/record 0.0.36 → 0.0.37

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/record.cjs CHANGED
@@ -1213,6 +1213,8 @@ function serializeElementNode(n2, options) {
1213
1213
  delete attributes.rel;
1214
1214
  delete attributes.href;
1215
1215
  attributes._cssText = cssText;
1216
+ } else {
1217
+ console.log("failed to extract stylesheets from link element", n2);
1216
1218
  }
1217
1219
  }
1218
1220
  if (tagName === "style" && n2.sheet) {
@@ -12580,12 +12582,27 @@ function record(options = {}) {
12580
12582
  console.warn(error);
12581
12583
  }
12582
12584
  });
12585
+ let initedAt = null;
12583
12586
  const init = () => {
12587
+ initedAt = Date.now();
12584
12588
  takeFullSnapshot$1();
12585
12589
  handlers.push(observe(document));
12586
12590
  recording = true;
12587
12591
  };
12592
+ const customOnLoad = () => {
12593
+ window.removeEventListener("load", customOnLoad);
12594
+ if (!recording || initedAt == null) return;
12595
+ console.log("customOnLoad wants to take a full snapshot");
12596
+ if (Date.now() - initedAt <= 10) {
12597
+ console.log("customOnLoad skipping full snapshot bc it was too soon");
12598
+ return;
12599
+ }
12600
+ console.log("customOnLoad taking full snapshot bc race condition");
12601
+ takeFullSnapshot$1();
12602
+ };
12603
+ window.addEventListener("load", customOnLoad);
12588
12604
  if (document.readyState === "interactive" || document.readyState === "complete") {
12605
+ console.log("fired init() bc readyState === 'interactive' || 'complete'");
12589
12606
  init();
12590
12607
  } else {
12591
12608
  handlers.push(
@@ -12594,7 +12611,10 @@ function record(options = {}) {
12594
12611
  type: EventType.DomContentLoaded,
12595
12612
  data: {}
12596
12613
  });
12597
- if (recordAfter === "DOMContentLoaded") init();
12614
+ if (recordAfter === "DOMContentLoaded") {
12615
+ console.log("fired init() bc listener 'DOMContentLoaded'");
12616
+ init();
12617
+ }
12598
12618
  })
12599
12619
  );
12600
12620
  handlers.push(
@@ -12605,7 +12625,10 @@ function record(options = {}) {
12605
12625
  type: EventType.Load,
12606
12626
  data: {}
12607
12627
  });
12608
- if (recordAfter === "load") init();
12628
+ if (recordAfter === "load") {
12629
+ console.log("fired init() bc listener 'load'");
12630
+ init();
12631
+ }
12609
12632
  },
12610
12633
  window
12611
12634
  )