@3dsource/angular-unreal-module 0.0.146-dev.10 → 0.0.146-dev.11

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.
@@ -6173,6 +6173,29 @@ class StreamStatusTelemetryService2 {
6173
6173
  const sigDur = wsOpenMs - startMs;
6174
6174
  const webDur = readyMs - wsOpenMs;
6175
6175
  const connectMs = readyMs - startMs;
6176
+ // Main-thread blocking from the OPTIONAL `perf-longtask.js` head-script. If
6177
+ // that script isn't on the page `window.__streamPerf` is undefined and
6178
+ // these stay 0 — nothing breaks. Tasks carry page-`performance.now()` start
6179
+ // times, so window them against the raw (pre-`toMs`) ready/adoption marks:
6180
+ // bootBlockingMs — total over [0, adoption]: overall JS cost to boot.
6181
+ // adoptBlockingMs — within [ready, adoption]: how much of the
6182
+ // "awaiting Angular code" gap was the thread actually
6183
+ // blocked by JS (vs idle waiting). ≈gap ⇒ JS-bound;
6184
+ // ≈0 ⇒ the app was just slow to reach the adopt call.
6185
+ const readyPerf = t['ready'] ?? t['dc_open'] ?? t['ws_open'] ?? s.startedAtPerf;
6186
+ const tasks = window.__streamPerf?.longTasks ?? [];
6187
+ let bootBlockingMs = 0;
6188
+ let adoptBlockingMs = 0;
6189
+ let maxLongTaskMs = 0;
6190
+ for (const lt of tasks) {
6191
+ if (lt.start > now)
6192
+ continue; // ignore tasks after adoption
6193
+ bootBlockingMs += lt.dur;
6194
+ if (lt.dur > maxLongTaskMs)
6195
+ maxLongTaskMs = lt.dur;
6196
+ if (lt.start >= readyPerf)
6197
+ adoptBlockingMs += lt.dur;
6198
+ }
6176
6199
  // Savings, anchored at the moment Angular reached the connect call.
6177
6200
  const savings = {
6178
6201
  prefetched: true,
@@ -6183,6 +6206,10 @@ class StreamStatusTelemetryService2 {
6183
6206
  adoptionWaitMs: Math.max(0, adoptionAtMs - sessionStartMs),
6184
6207
  // Gap between the prefetch being ready and Angular adopting it.
6185
6208
  adoptionOverheadMs: Math.max(0, adoptionAtMs - readyMs),
6209
+ // Main-thread blocking (longtask) — diagnoses whether the gap is JS-bound.
6210
+ bootBlockingMs: Math.round(bootBlockingMs),
6211
+ adoptBlockingMs: Math.round(adoptBlockingMs),
6212
+ maxLongTaskMs: Math.round(maxLongTaskMs),
6186
6213
  };
6187
6214
  // Region (phaseNo 1) — served from the ping cache during prefetch (~0),
6188
6215
  // positioned at the prefetch start; ship the samples.