In-flight Resource Requests
TPAC Oct 2018
npm@chromium.org
What do we want to solve?
We want to allow web developers to receive information about resource requests that have not been completed.
Sample use cases:
Goals of this presentation
I’ll present a proposed plan and some alternatives considered. Then we can agree on the best choice. Downsides of each proposal will be highlighted.
How do we propose solving this?
We propose adding a ResourceTimingUpdate interface that notifies when attributes have been computed.
How will this look like in IDL?
interface ResourceTimingUpdate : PerformanceResourceTiming {
// “resourceUpdate”
readonly attribute DOMString entryType;
// All other inherited values are null before reaching their final state, then the final // value once they reach the final state.
� // List of strings with the names of attributes that have reached their final state.� readonly attribute sequence<DOMString> attributesUpdated;
}
Alternative 1: Modify PerformanceResourceTiming
One alternative is to modify the dispatch logic of PerformanceResourceTiming so that in-flight resource requests are also exposed.
Alternative 2: event listeners for requests and responses
Another alternative is to have event listeners that would trigger callbacks whenever a request begins and whenever a response has been received.
Alternative 3: Create a FetchObserver
To better integrate with Fetch, we could create a FetchObserver that observes resource request updates.
Discussion Time!