w3c / long-animation-frames

Long Animation Frame API specification repository
Other
10 stars 1 forks source link

[LoAF] Settle on what `PerformanceScriptTiming.name` means #7

Closed noamr closed 10 months ago

noamr commented 10 months ago

It feels a bit weird that name is actually a string that can mean several things, and in fact represents the invoker. Proposal:

Open to other proposals and feedback.

lasseschou commented 10 months ago

Gathering RUM data with PageVitals, I'm trying to get familiar with the different results being sent from the LoAF API.

I think type is a great name for event-listener, classic-script, user-callback, promise-resolve, ... so I'd rather keep that.

Renaming name to invoker could be a good idea because if gives the developer a better notion of what this really means.

In the case of type "classic-script" it's a bit redundant to have the script URL both in the name (or invoker) and the sourceLocation. It looks like they are the same in this case - but where sourceLocation may also have the invoked entry function as well as the column number.

noamr commented 10 months ago

Gathering RUM data with PageVitals, I'm trying to get familiar with the different results being sent from the LoAF API.

I think type is a great name for event-listener, classic-script, user-callback, promise-resolve, ... so I'd rather keep that.

Renaming name to invoker could be a good idea because if gives the developer a better notion of what this really means.

In the case of type "classic-script" it's a bit redundant to have the script URL both in the name (or invoker) and the sourceLocation. It looks like they are the same in this case - but where sourceLocation may also have the invoked entry function as well as the column number.

The reason to have anything at all in name is because in the future we might want to make these nested performance entries available via performance.getEntriesByName(), though this is likely a YAGNI.

borisschapira commented 10 months ago

With @noamr proposal, we would no longer be able to use performance.getEntriesByName() to collect all LoAF. What could we use instead, performance.getEntries().filter(x => x.constructor.name == 'PerformanceLongAnimationFrameTiming')? (whether or not it's relevant is another question, I'm just trying to wrap my mind around it).

I feel like whether we keep name for event-listener, classic-script, user-callback, promise-resolve goes further that LoAF. PerformanceResourceTimings have names with URLs. PerformancePaintTimings have names that are more alike to what @lasseschou calls invoker, I feel it's already quite inconsistent. But using performance.getEntriesByName() to retrieve a specific kind of LoAF makes sense so why not.

noamr commented 10 months ago

With @noamr proposal, we would no longer be able to use performance.getEntriesByName() to collect all LoAF.

To clarify, this is only about the LoAF's scripts, which ATM are not retrieved with getEntriesByName.

borisschapira commented 10 months ago

Oh sorry, I'll think about it again, then.

borisschapira commented 10 months ago

In PerformanceNavigationTiming, type is a string representing the navigation type. event-listener, classic-script, etc. are not Script types, so for the sake of spec coherence, I feel like type is not necessarily adapted.

In PerformanceServerTiming, name is a string representing the name of the timing. I feel that event-listener, classic-script, etc. are not names either, rather qualifiers.

Couldn't they be entryType instead? script is quite redundant there…

noamr commented 10 months ago

In PerformanceNavigationTiming, type is a string representing the navigation type. event-listener, classic-script, etc. are not Script types, so for the sake of spec coherence, I feel like type is not necessarily adapted.

In PerformanceServerTiming, name is a string representing the name of the timing. I feel that event-listener, classic-script, etc. are not names either, rather qualifiers.

Couldn't they be entryType instead? script is quite redundant there…

That's an option. They're not exactly the type of script, I thought to rename that invokerType. In most cases the entryType matches the IDL type (e.g. resource matches to PerformanceResourceTiming)

aarontgrogg commented 10 months ago

Am with @lasseschou, type feels more descriptive than name for event-listener, script-block etc.. invoker is very clear, like that, though DevTools > Network panel uses initiator, which is also quite descriptive?

noamr commented 10 months ago

I think perhaps invokerType rather than type though, e.g. the entryType is still script (maps with the IDL PerformanceScriptTiming)

borisschapira commented 10 months ago

So, invoker + invokerType or initiator + initiatorType, then? I must say I like initiator.