@absolutejs/beacon 0.6.17 → 0.6.18
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/README.md +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +15 -3
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -142,6 +142,8 @@ beacon.captureMessage("checkout started", "info");
|
|
|
142
142
|
inverted brand/media surfaces use `data-beacon-theme="allow"`. Loading UI
|
|
143
143
|
participates through native `aria-busy`/`role="progressbar"` semantics or
|
|
144
144
|
`data-beacon-loading`, without coupling the SDK to framework class names.
|
|
145
|
+
Long-running loaders can set `data-beacon-loading-timeout="60000"` to
|
|
146
|
+
override the global stuck-loading deadline for that element only.
|
|
145
147
|
- **Browser capability failures** — rejected clipboard writes are observed even
|
|
146
148
|
when application code catches them (contents are never read), visible WebGL
|
|
147
149
|
contexts that do not restore after `webglcontextlost` become warnings, and a
|
package/dist/index.d.ts
CHANGED
|
@@ -83,6 +83,8 @@ export declare const BEACON_ATTRIBUTE: {
|
|
|
83
83
|
readonly EMBED: "data-beacon-embed";
|
|
84
84
|
/** Marks loading UI that should participate in the stuck-loading watchdog. */
|
|
85
85
|
readonly LOADING: "data-beacon-loading";
|
|
86
|
+
/** Overrides the stuck-loading deadline for one loading element, in ms. */
|
|
87
|
+
readonly LOADING_TIMEOUT: "data-beacon-loading-timeout";
|
|
86
88
|
/** Names a form whose dirty navigation should be reported as abandonment. */
|
|
87
89
|
readonly FORM: "data-beacon-form";
|
|
88
90
|
/** Names media whose user-visible playback should be watched. */
|
package/dist/index.js
CHANGED
|
@@ -65,6 +65,7 @@ var BEACON_ATTRIBUTE = {
|
|
|
65
65
|
NAME: "data-beacon-name",
|
|
66
66
|
EMBED: "data-beacon-embed",
|
|
67
67
|
LOADING: "data-beacon-loading",
|
|
68
|
+
LOADING_TIMEOUT: "data-beacon-loading-timeout",
|
|
68
69
|
FORM: "data-beacon-form",
|
|
69
70
|
MEDIA: "data-beacon-media",
|
|
70
71
|
OVERFLOW: "data-beacon-overflow",
|
|
@@ -2180,6 +2181,13 @@ var createBeacon = (options) => {
|
|
|
2180
2181
|
};
|
|
2181
2182
|
const loadingFirstSeen = new WeakMap;
|
|
2182
2183
|
const reportedStuckLoading = new WeakSet;
|
|
2184
|
+
const loadingDeadlineMs = (indicator) => {
|
|
2185
|
+
const configured = indicator.getAttribute(BEACON_ATTRIBUTE.LOADING_TIMEOUT)?.trim();
|
|
2186
|
+
if (!configured)
|
|
2187
|
+
return stuckLoadingMs;
|
|
2188
|
+
const parsed = Number(configured);
|
|
2189
|
+
return Number.isSafeInteger(parsed) && parsed >= 0 ? parsed : stuckLoadingMs;
|
|
2190
|
+
};
|
|
2183
2191
|
const checkStuckLoading = () => {
|
|
2184
2192
|
if (document.visibilityState === "hidden")
|
|
2185
2193
|
return;
|
|
@@ -2196,11 +2204,15 @@ var createBeacon = (options) => {
|
|
|
2196
2204
|
loadingFirstSeen.set(indicator, now);
|
|
2197
2205
|
continue;
|
|
2198
2206
|
}
|
|
2199
|
-
|
|
2207
|
+
const deadlineMs = loadingDeadlineMs(indicator);
|
|
2208
|
+
if (now - firstSeen < deadlineMs || reportedStuckLoading.has(indicator)) {
|
|
2200
2209
|
continue;
|
|
2201
2210
|
}
|
|
2202
2211
|
reportedStuckLoading.add(indicator);
|
|
2203
|
-
reportScanIssue(indicator, BEACON_SIGNAL.STUCK_LOADING, `Stuck loading — ${describeElement(indicator)} never resolved`, {
|
|
2212
|
+
reportScanIssue(indicator, BEACON_SIGNAL.STUCK_LOADING, `Stuck loading — ${describeElement(indicator)} never resolved`, {
|
|
2213
|
+
deadlineMs: String(deadlineMs),
|
|
2214
|
+
visibleMs: String(now - firstSeen)
|
|
2215
|
+
});
|
|
2204
2216
|
}
|
|
2205
2217
|
};
|
|
2206
2218
|
const checkBlankAppRoots = () => {
|
|
@@ -3788,5 +3800,5 @@ export {
|
|
|
3788
3800
|
BEACON_ATTRIBUTE
|
|
3789
3801
|
};
|
|
3790
3802
|
|
|
3791
|
-
//# debugId=
|
|
3803
|
+
//# debugId=41713D2C1F9DB43B64756E2164756E21
|
|
3792
3804
|
//# sourceMappingURL=index.js.map
|