- From: Ben Kelly <notifications@github.com>
- Date: Wed, 14 Dec 2016 14:37:20 -0800
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 14 December 2016 22:37:52 UTC
Currently the browser makes a number of decisions about what network requests are high priority vs low priority. We could expose this as a `Request.priority` attribute.
In addition, we could allow script to set this so that authors can hint that some requests are low priority. For example, think of a `requestIdleCallback()` that is intended to avoid interfering with normal page operation, but it needs a network request. It could use a "low" priority.
Another use case would be pre-caching resources at a low priority in a ServiceWorker's install event handler. This would reduce any impact to the currently displayed page.
I don't think we would want to guarantee honoring the value, though. It would be a hint and best effort by the browser.
Webidl sketch:
```
interface Request
{
readonly attribute RequestPriority priority;
};
dictionary RequestInit
{
RequestPriority priority;
};
enum RequestPriority { "low", "normal", "high" };
```
Service workers would also be able to inspect priority:
```
addEventListener('fetch', evt => {
if (evt.request.priority === 'high') {
// high priority request
}
});
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/436
Received on Wednesday, 14 December 2016 22:37:52 UTC