@gem-sdk/pages 1.57.0-staging.8 → 1.57.0-staging.9
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.
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const waitForElementToExist = (selector, timeout = 200)=>{
|
|
4
4
|
return new Promise((resolve)=>{
|
|
5
|
+
let intervalID = null;
|
|
6
|
+
let timeoutID = null;
|
|
5
7
|
const findEl = ()=>{
|
|
6
8
|
const el = document.body.querySelector('#storefront')?.querySelector(selector);
|
|
7
9
|
if (el) {
|
|
@@ -11,10 +13,10 @@ const waitForElementToExist = (selector, timeout = 200)=>{
|
|
|
11
13
|
}
|
|
12
14
|
};
|
|
13
15
|
findEl();
|
|
14
|
-
|
|
16
|
+
intervalID = setInterval(()=>{
|
|
15
17
|
findEl();
|
|
16
18
|
}, 50);
|
|
17
|
-
|
|
19
|
+
timeoutID = setTimeout(()=>{
|
|
18
20
|
if (intervalID) clearInterval(intervalID);
|
|
19
21
|
if (timeoutID) clearTimeout(timeoutID);
|
|
20
22
|
resolve(null);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const waitForElementToExist = (selector, timeout = 200)=>{
|
|
2
2
|
return new Promise((resolve)=>{
|
|
3
|
+
let intervalID = null;
|
|
4
|
+
let timeoutID = null;
|
|
3
5
|
const findEl = ()=>{
|
|
4
6
|
const el = document.body.querySelector('#storefront')?.querySelector(selector);
|
|
5
7
|
if (el) {
|
|
@@ -9,10 +11,10 @@ const waitForElementToExist = (selector, timeout = 200)=>{
|
|
|
9
11
|
}
|
|
10
12
|
};
|
|
11
13
|
findEl();
|
|
12
|
-
|
|
14
|
+
intervalID = setInterval(()=>{
|
|
13
15
|
findEl();
|
|
14
16
|
}, 50);
|
|
15
|
-
|
|
17
|
+
timeoutID = setTimeout(()=>{
|
|
16
18
|
if (intervalID) clearInterval(intervalID);
|
|
17
19
|
if (timeoutID) clearTimeout(timeoutID);
|
|
18
20
|
resolve(null);
|