@percy/dom 1.29.4 → 1.29.5-beta.0

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.
Files changed (2) hide show
  1. package/dist/bundle.js +18 -0
  2. package/package.json +3 -3
package/dist/bundle.js CHANGED
@@ -610,6 +610,22 @@
610
610
  }
611
611
  }
612
612
 
613
+ // This is used by SDK's in captureResponsiveSnapshot
614
+ function waitForResize() {
615
+ // if window resizeCount present means event listener was already present
616
+ if (!window.resizeCount) {
617
+ let resizeTimeout = false;
618
+ window.addEventListener('resize', () => {
619
+ if (resizeTimeout !== false) {
620
+ clearTimeout(resizeTimeout);
621
+ }
622
+ resizeTimeout = setTimeout(() => window.resizeCount++, 100);
623
+ });
624
+ }
625
+ // always reset count 0
626
+ window.resizeCount = 0;
627
+ }
628
+
613
629
  // Serializes a document and returns the resulting DOM string.
614
630
  function serializeDOM(options) {
615
631
  let {
@@ -666,6 +682,7 @@
666
682
  let result = {
667
683
  html: serializeHTML(ctx),
668
684
  cookies: cookies,
685
+ userAgent: navigator.userAgent,
669
686
  warnings: Array.from(ctx.warnings),
670
687
  resources: Array.from(ctx.resources),
671
688
  hints: Array.from(ctx.hints)
@@ -723,6 +740,7 @@
723
740
  exports.loadAllSrcsetLinks = loadAllSrcsetLinks;
724
741
  exports.serialize = serializeDOM;
725
742
  exports.serializeDOM = serializeDOM;
743
+ exports.waitForResize = waitForResize;
726
744
 
727
745
  Object.defineProperty(exports, '__esModule', { value: true });
728
746
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/dom",
3
- "version": "1.29.4",
3
+ "version": "1.29.5-beta.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public",
12
- "tag": "latest"
12
+ "tag": "beta"
13
13
  },
14
14
  "main": "dist/bundle.js",
15
15
  "browser": "dist/bundle.js",
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "interactor.js": "^2.0.0-beta.10"
37
37
  },
38
- "gitHead": "17468058cf55d75557451a81e82b0d6fd5c0e26b"
38
+ "gitHead": "1edb0e95570ca077e8ef931b53399c04d71a95bd"
39
39
  }