Comments (4)
That's a good use case. My proposal would be to expose:
interface NetworkInformation : EventTarget {
readonly attribute DOMString saveData;
};
The value would contain the token communicated in the Save-Data header. Today this would yield a single value of "on", but the IETF spec does allow us to define other token values and we should support that here as well.
from netinfo.
I wonder if one could just get the Save-Data client hint from the outgoing Request? That may allow modification of the Request's URL if need be upon the SW fetch event on a per Request basis without the need to expose this in the API.
The decision about what to store in the cache is generally made on "environmental conditions" and those are not enforceable with Save Data (unlike with something akin to Content Performance Policy).
The risk is that this signal is of limited value because it's not enforceable (similar to DNT) - which may end up confusing or frustrating user who set this, but then just get ignored by sites.
from netinfo.
Just to clarify something from @marcoscaceres's previous comment, this information would be most useful if it were available inside of a service worker's install
handler, which is the event that's normally associated with precaching.
There's no Request
exposed in the InstallEvent
that's passed to the install
handler.
from netinfo.
@igrigorik's proposed extension to NetworkInformation sounds great to me for the reason already mentioned by @jeffposnick (for SW decision making related to precaching). I can see it also being a good signal for adaptive video libraries to degrade quality somewhat to reduce network data use.
from netinfo.
Related Issues (20)
- Update the thresholds for different effective connection types HOT 7
- IANA section with registrations HOT 2
- Somewhat mangled IDL for NetworkInfomation HOT 2
- Fix indent in EXAMPLE 1
- Support .toJSON() on NetworkInformation interface
- Remove [NoInterfaceObject] HOT 2
- Include a separate “metered network” property in addition to “save data” HOT 1
- Netinfo status
- Should we archive this? HOT 21
- Can we just do metered? HOT 3
- Should `effectiveConnectionType` be a fixed set of values? HOT 15
- Revise use cases
- Privacy review and standards track plan HOT 1
- Should ontypechange be added again?
- compatibilité d'affichage mobile HOT 1
- Update repo and spec to show this is no longer being actively incubated HOT 6
- [tomayac/netinfo 🍴] `isMetered` should be `metered` HOT 1
- [tomayac/netinfo 🍴] Remove typedef HOT 1
- [tomayac/netinfo 🍴] Need to document why `sustainedSpeed` can be `Infinity` HOT 1
- Client Hints should get Sec-CH- prefixes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from netinfo.