@lightpath-dev/browser 0.0.1 → 0.0.2
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/collector.js +6 -5
- package/package.json +1 -1
package/dist/collector.js
CHANGED
|
@@ -238,7 +238,7 @@ export class BrowserCollector {
|
|
|
238
238
|
const boundary = this.#release ? 'release' : 'press';
|
|
239
239
|
this.#log(`click on ${labelFor(target)}: paused ${(performance.now() - pausedAt).toFixed(1)}ms, boundary ${boundary}, trace ${traceId}`);
|
|
240
240
|
// Key presses never lose events to a pause, so only pointer presses count toward the budget.
|
|
241
|
-
if (!target.key)
|
|
241
|
+
if (!target.key && boundary === 'press')
|
|
242
242
|
await this.#checkBudget(readMs);
|
|
243
243
|
void this.#emit('background', before, at);
|
|
244
244
|
this.#opts.send({
|
|
@@ -306,14 +306,15 @@ export class BrowserCollector {
|
|
|
306
306
|
if (this.#active)
|
|
307
307
|
return;
|
|
308
308
|
await this.#emit('background', await this.#take(), Date.now());
|
|
309
|
-
//
|
|
310
|
-
//
|
|
311
|
-
|
|
309
|
+
// A second read files what the page ran right after load, background too. It isn't timed
|
|
310
|
+
// against the press budget: the page can still be busy here, so this read can cost more than
|
|
311
|
+
// any click's (Actual: 20.8 ms, while 103 press reads stayed under 18.9 ms). Only a read at a
|
|
312
|
+
// pointer press moves the boundary (D-082, D-105).
|
|
312
313
|
await this.#emit('background', await this.#take(), Date.now());
|
|
313
|
-
await this.#checkBudget(performance.now() - started);
|
|
314
314
|
})
|
|
315
315
|
.catch((err) => this.#log(`load-time coverage read failed: ${err.message}`));
|
|
316
316
|
}
|
|
317
|
+
/** Called only with the read taken while the page is paused at a pointer press (D-105). */
|
|
317
318
|
async #checkBudget(readMs) {
|
|
318
319
|
const budget = this.#opts.pressBudgetMs ?? PRESS_BUDGET_MS;
|
|
319
320
|
if (this.#release || readMs <= budget)
|