WebAPI/NetworkAPI: Difference between revisions
< WebAPI
Jump to navigation
Jump to search
(→Notes) |
No edit summary |
||
(11 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
== Device API specification == | == Device API specification == | ||
The DAP WG (W3C) has specification sharing this proposal goal [1]. Our proposal might or might not look like it for the moment. Suggestions and comments will be submitted to the Device Status Task Force [2]. | The DAP WG (W3C) has a specification sharing this proposal goal [1]. Our proposal might or might not look like it for the moment. Suggestions and comments will be submitted to the Device Status Task Force [2]. | ||
[1] http://dev.w3.org/2009/dap/netinfo/ | [1] http://dev.w3.org/2009/dap/netinfo/<br> | ||
[2] http://lists.w3.org/Archives/Public/public-device-status/ | [2] http://lists.w3.org/Archives/Public/public-device-status/ | ||
== Status == | == Status == | ||
The proposed specification doesn't have a working implementation yet. The implementation will be done in | The proposed specification doesn't have a working implementation yet. The implementation will be done in http://bugzil.la/677166. | ||
== Demo == | == Demo == | ||
Line 16: | Line 16: | ||
== Proposed API == | == Proposed API == | ||
partial interface Navigator { | |||
readonly attribute Connection connection; | readonly attribute Connection connection; | ||
}; | }; | ||
interface Connection | |||
{ | |||
// Estimated bandwidth (in MB/s) of the current connection. | |||
readonly attribute double bandwidth; | |||
// Return whether the current connection is metered (like quota limitation, pay per use, etc.). | |||
readonly attribute boolean metered; | |||
// A 'change' event is fired when one of the previous attributes is changed. | |||
attribute Function onchange; | |||
// | |||
} | } | ||
== Notes == | == Notes == | ||
* . | * .bandwidth should be an estimated value of the download speed. That could be based on pure empirical observations (like 3G is usually around 300kB/s) or very precise value. However, this is an implementation detail and the consumer of this API shouldn't care about how the estimation is made. | ||
* . | * .metered reflects whether the current connection bandwidth is metered in the sense of there is a pay-per-use policy or a periodic quota. This is typical for 2G and 3G connections. Firefox will implement this by asking the user. | ||
* There is no .type because we believe that might be abused. It could be added later if there is a strong need for it. | * There is no .type because we believe that might be abused: it is error-prone and not future-proof. It could be added later if there is a strong need for it. | ||
== Considered changes == | == Considered changes == | ||
[[Category:Web APIs]] |
Latest revision as of 23:54, 1 October 2014
Device API specification
The DAP WG (W3C) has a specification sharing this proposal goal [1]. Our proposal might or might not look like it for the moment. Suggestions and comments will be submitted to the Device Status Task Force [2].
[1] http://dev.w3.org/2009/dap/netinfo/
[2] http://lists.w3.org/Archives/Public/public-device-status/
Status
The proposed specification doesn't have a working implementation yet. The implementation will be done in http://bugzil.la/677166.
Demo
TBD
Proposed API
partial interface Navigator { readonly attribute Connection connection; }; interface Connection { // Estimated bandwidth (in MB/s) of the current connection. readonly attribute double bandwidth; // Return whether the current connection is metered (like quota limitation, pay per use, etc.). readonly attribute boolean metered; // A 'change' event is fired when one of the previous attributes is changed. attribute Function onchange; }
Notes
- .bandwidth should be an estimated value of the download speed. That could be based on pure empirical observations (like 3G is usually around 300kB/s) or very precise value. However, this is an implementation detail and the consumer of this API shouldn't care about how the estimation is made.
- .metered reflects whether the current connection bandwidth is metered in the sense of there is a pay-per-use policy or a periodic quota. This is typical for 2G and 3G connections. Firefox will implement this by asking the user.
- There is no .type because we believe that might be abused: it is error-prone and not future-proof. It could be added later if there is a strong need for it.