@huaqiu/dsh-analytics 0.6.24 → 0.6.25
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/lib/client.js +18 -2
- package/lib/client.js.map +1 -1
- package/lib/index.mjs +3 -0
- package/package.json +3 -3
- package/src/client/index.ts +20 -2
- package/src/generated/builtin-tools.ts +3 -0
package/lib/client.js
CHANGED
|
@@ -3171,9 +3171,25 @@ window.__ModuleLoader__.load({
|
|
|
3171
3171
|
function apply(ctx) {
|
|
3172
3172
|
const disposers = [];
|
|
3173
3173
|
let disposed = false;
|
|
3174
|
-
|
|
3174
|
+
const waitForTargetHost = () => new Promise((resolve) => {
|
|
3175
|
+
let timer;
|
|
3176
|
+
const finish = (targetHost) => {
|
|
3177
|
+
if (timer !== void 0) window.clearInterval(timer);
|
|
3178
|
+
resolve(targetHost);
|
|
3179
|
+
};
|
|
3180
|
+
const read = () => {
|
|
3181
|
+
if (disposed) return finish(null);
|
|
3182
|
+
const targetHost = ctx.get?.("hqEdge")?.context?.getTargetHost?.() ?? "";
|
|
3183
|
+
if (targetHost === "hq-eda" || targetHost === "kicad") finish(targetHost);
|
|
3184
|
+
};
|
|
3185
|
+
timer = window.setInterval(read, 200);
|
|
3186
|
+
disposers.push(() => finish(null));
|
|
3187
|
+
read();
|
|
3188
|
+
});
|
|
3189
|
+
resolveHostMode().then(async (hostMode) => {
|
|
3175
3190
|
if (disposed) return;
|
|
3176
|
-
const targetHost =
|
|
3191
|
+
const targetHost = hostMode ? await waitForTargetHost() : "";
|
|
3192
|
+
if (disposed || targetHost === null) return;
|
|
3177
3193
|
const analytics = createAnalytics(import_sensorsdata_min.default, {
|
|
3178
3194
|
hostMode,
|
|
3179
3195
|
targetHost
|