@honeypot-run/core
Advanced tools
Comparing version 0.2.45 to 0.2.46
@@ -189,8 +189,26 @@ "use strict"; | ||
} | ||
else if (this.didLoad && !this.didInit) { | ||
return new Promise((resolve, reject) => { | ||
const startTime = Date.now(); | ||
const retryLoad = () => { | ||
if (window.honeypot && window.honeypot.get) { | ||
resolve(window.honeypot.get()); | ||
} | ||
else if (Date.now() - startTime >= 2000) { | ||
reject(new Error("Timeout: Honeypot SDK did not initialize in time.")); | ||
} | ||
else { | ||
setTimeout(retryLoad, 50); | ||
} | ||
}; | ||
retryLoad(); | ||
}); | ||
} | ||
return new Promise((resolve, reject) => { | ||
const e = () => { | ||
var _a; | ||
if (window.honeypot && window.honeypot.honey) { | ||
resolve(window.honeypot.honey); | ||
} | ||
else if (window.honeypot) { | ||
else if ((_a = window.honeypot) === null || _a === void 0 ? void 0 : _a.get) { | ||
return window.honeypot.get(); | ||
@@ -197,0 +215,0 @@ } |
@@ -186,8 +186,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
else if (this.didLoad && !this.didInit) { | ||
return new Promise((resolve, reject) => { | ||
const startTime = Date.now(); | ||
const retryLoad = () => { | ||
if (window.honeypot && window.honeypot.get) { | ||
resolve(window.honeypot.get()); | ||
} | ||
else if (Date.now() - startTime >= 2000) { | ||
reject(new Error("Timeout: Honeypot SDK did not initialize in time.")); | ||
} | ||
else { | ||
setTimeout(retryLoad, 50); | ||
} | ||
}; | ||
retryLoad(); | ||
}); | ||
} | ||
return new Promise((resolve, reject) => { | ||
const e = () => { | ||
var _a; | ||
if (window.honeypot && window.honeypot.honey) { | ||
resolve(window.honeypot.honey); | ||
} | ||
else if (window.honeypot) { | ||
else if ((_a = window.honeypot) === null || _a === void 0 ? void 0 : _a.get) { | ||
return window.honeypot.get(); | ||
@@ -194,0 +212,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"author": "https://honeypot.run", | ||
"version": "0.2.45", | ||
"version": "0.2.46", | ||
"license": "BUSL-1.1", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
27782
704