-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core(responsiveness): use raw trace event #13970
Conversation
* Base event of a `ph: 'X'` 'complete' event. Extend with `name` and `args` as | ||
* needed. | ||
*/ | ||
interface CompleteEvent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kind of harkens back to your trace types, @connorjclark :)
I kind of like this pattern of building up the event type compared to the Omit<>
+build pattern used here:
lighthouse/lighthouse-core/lib/tracehouse/trace-processor.js
Lines 21 to 23 in 0fcf4a7
/** @typedef {Omit<LH.TraceEvent, 'name'|'args'> & {name: 'FrameCommittedInBrowser', args: {data: {frame: string, url: string, parent?: string}}}} FrameCommittedEvent */ | |
/** @typedef {Omit<LH.TraceEvent, 'name'|'args'> & {name: 'largestContentfulPaint::Invalidate'|'largestContentfulPaint::Candidate', args: {data?: {size?: number}, frame: string}}} LCPEvent */ | |
/** @typedef {Omit<LH.TraceEvent, 'name'|'args'> & {name: 'largestContentfulPaint::Candidate', args: {data: {size: number}, frame: string}}} LCPCandidateEvent */ |
(where you still have some random optional properties from the LH.TraceEvent
frankenstein)
@@ -11,50 +11,51 @@ | |||
* user input in the provided trace). | |||
*/ | |||
|
|||
/** @typedef {LH.Trace.CompleteEvent & {name: 'Responsiveness.Renderer.UserInteraction', args: {frame: string, data: {interactionType: 'drag'|'keyboard'|'tapOrClick', maxDuration: number}}}} ResponsivenessEvent */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: did you consider defining this in .d.ts
(for ergonomic reasons)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: did you consider defining this in
.d.ts
(for ergonomic reasons)?
maybe if it spreads, but so far it's really just needed in this one file and the two files that call it are fine with the implicit type from the function return.
There's also the multi-line jsdoc format, it's just unfortunate that vscode doesn't do better syntax highlighting for it (probably should file that as an issue at some point).
part of #13916
Rather than the responsiveness computed artifact returning just the duration, it now returns the whole trace event, which will allow the attribution audit to use all the other properties on that same event.
Functionality is unchanged.