@hortonstudio/main 1.7.11 → 1.7.12
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/index.js +26 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version:1.7.
|
|
1
|
+
// Version:1.7.12
|
|
2
2
|
const API_NAME = "hsmain";
|
|
3
3
|
|
|
4
4
|
const initializeHsMain = async () => {
|
|
@@ -254,6 +254,28 @@ const initializeHsMain = async () => {
|
|
|
254
254
|
});
|
|
255
255
|
});
|
|
256
256
|
|
|
257
|
+
const waitForIx2 = async () => {
|
|
258
|
+
const startTime = Date.now();
|
|
259
|
+
const timeout = 2000; // 2 second timeout
|
|
260
|
+
|
|
261
|
+
return new Promise((resolve) => {
|
|
262
|
+
const checkIx2 = () => {
|
|
263
|
+
const htmlElement = document.documentElement;
|
|
264
|
+
const hasIx2 = htmlElement.classList.contains('w-mod-ix3');
|
|
265
|
+
|
|
266
|
+
if (hasIx2) {
|
|
267
|
+
resolve(true);
|
|
268
|
+
} else if (Date.now() - startTime >= timeout) {
|
|
269
|
+
console.warn('[hsmain] IX2 (w-mod-ix3) not detected after 2s timeout. Proceeding anyway, but Webflow interactions may not be fully loaded.');
|
|
270
|
+
resolve(false);
|
|
271
|
+
} else {
|
|
272
|
+
setTimeout(checkIx2, 50);
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
checkIx2();
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
|
|
257
279
|
const finalize = async () => {
|
|
258
280
|
processModules();
|
|
259
281
|
await waitForWebflow();
|
|
@@ -266,6 +288,9 @@ const initializeHsMain = async () => {
|
|
|
266
288
|
window.Webflow.ready();
|
|
267
289
|
}
|
|
268
290
|
|
|
291
|
+
// Wait for IX2 to be ready before firing callbacks
|
|
292
|
+
await waitForIx2();
|
|
293
|
+
|
|
269
294
|
window[API_NAME].loaded = true;
|
|
270
295
|
readyCallbacks.forEach((callback) => {
|
|
271
296
|
try {
|