@absolutejs/beacon 0.6.5 → 0.6.6

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/dist/index.d.ts CHANGED
@@ -302,7 +302,7 @@ export type BeaconSignals = {
302
302
  mediaFailures?: boolean;
303
303
  /** Time continuously waiting/stalled before reporting. Default 10000ms. */
304
304
  mediaStallMs?: number;
305
- /** Long-frame duration that counts as a main-thread stall. Default 200ms. */
305
+ /** Blocking duration that counts as a main-thread stall. Default 200ms. */
306
306
  mainThreadStallMs?: number;
307
307
  /** Stalls inside the window that trip a report. Default 3. */
308
308
  mainThreadStallCount?: number;
package/dist/index.js CHANGED
@@ -1335,7 +1335,9 @@ var createBeacon = (options) => {
1335
1335
  if (reported || document.visibilityState === "hidden")
1336
1336
  return;
1337
1337
  for (const entry of list.getEntries()) {
1338
- if (entry.duration < stallMs)
1338
+ const animationFrame = entry;
1339
+ const blockingDuration = entry.entryType === "long-animation-frame" && animationFrame.blockingDuration !== undefined ? animationFrame.blockingDuration : entry.duration;
1340
+ if (blockingDuration < stallMs)
1339
1341
  continue;
1340
1342
  const now = Date.now();
1341
1343
  stallTimes = stallTimes.filter((at) => now - at < stallWindowMs);
@@ -1343,7 +1345,6 @@ var createBeacon = (options) => {
1343
1345
  if (stallTimes.length < stallCount)
1344
1346
  continue;
1345
1347
  reported = true;
1346
- const animationFrame = entry;
1347
1348
  const script = [...animationFrame.scripts ?? []].sort((left, right) => (right.duration ?? 0) - (left.duration ?? 0))[0];
1348
1349
  emitSignal(`Main-thread stall — repeated long frames blocked the page — ${shortUrl(location.href)}`, {
1349
1350
  ...animationFrame.blockingDuration === undefined ? {} : {
@@ -3579,5 +3580,5 @@ export {
3579
3580
  BEACON_ATTRIBUTE
3580
3581
  };
3581
3582
 
3582
- //# debugId=BB4BB2A50E2A609E64756E2164756E21
3583
+ //# debugId=89339955D8F62E0E64756E2164756E21
3583
3584
  //# sourceMappingURL=index.js.map