@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.
@@ -1246,6 +1246,8 @@ function serializeElementNode(n2, options) {
1246
1246
  delete attributes.rel;
1247
1247
  delete attributes.href;
1248
1248
  attributes._cssText = cssText;
1249
+ } else {
1250
+ console.log("failed to extract stylesheets from link element", n2);
1249
1251
  }
1250
1252
  }
1251
1253
  if (tagName === "style" && n2.sheet) {
@@ -12605,12 +12607,27 @@ function record(options = {}) {
12605
12607
  console.warn(error);
12606
12608
  }
12607
12609
  });
12610
+ let initedAt = null;
12608
12611
  const init = () => {
12612
+ initedAt = Date.now();
12609
12613
  takeFullSnapshot$1();
12610
12614
  handlers.push(observe(document));
12611
12615
  recording = true;
12612
12616
  };
12617
+ const customOnLoad = () => {
12618
+ window.removeEventListener("load", customOnLoad);
12619
+ if (!recording || initedAt == null) return;
12620
+ console.log("customOnLoad wants to take a full snapshot");
12621
+ if (Date.now() - initedAt <= 10) {
12622
+ console.log("customOnLoad skipping full snapshot bc it was too soon");
12623
+ return;
12624
+ }
12625
+ console.log("customOnLoad taking full snapshot bc race condition");
12626
+ takeFullSnapshot$1();
12627
+ };
12628
+ window.addEventListener("load", customOnLoad);
12613
12629
  if (document.readyState === "interactive" || document.readyState === "complete") {
12630
+ console.log("fired init() bc readyState === 'interactive' || 'complete'");
12614
12631
  init();
12615
12632
  } else {
12616
12633
  handlers.push(
@@ -12619,7 +12636,10 @@ function record(options = {}) {
12619
12636
  type: EventType.DomContentLoaded,
12620
12637
  data: {}
12621
12638
  });
12622
- if (recordAfter === "DOMContentLoaded") init();
12639
+ if (recordAfter === "DOMContentLoaded") {
12640
+ console.log("fired init() bc listener 'DOMContentLoaded'");
12641
+ init();
12642
+ }
12623
12643
  })
12624
12644
  );
12625
12645
  handlers.push(
@@ -12630,7 +12650,10 @@ function record(options = {}) {
12630
12650
  type: EventType.Load,
12631
12651
  data: {}
12632
12652
  });
12633
- if (recordAfter === "load") init();
12653
+ if (recordAfter === "load") {
12654
+ console.log("fired init() bc listener 'load'");
12655
+ init();
12656
+ }
12634
12657
  },
12635
12658
  window
12636
12659
  )