-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose getBattery to ServiceWorker #4
Comments
Yes. It was identified as a good candidate for future work (think v2), see: https://www.w3.org/2009/dap/wiki/FutureWork |
Thanks @anssiko. |
However, the only change would be adding something like |
The spec change is trivial, but the involved process is not. The spec is now at PR. To add this new feature, we'd need to go back to WD, then CR and then again to PR and demonstrate interoperability i.e. wait for the existing implementations to update themselves and update the test suite as well. |
I understand (I was just trying to push a bit :-) perhaps I should push on implementers instead). |
I'll keep this issue open to collect feedback from implementers. If there's interest to expose this API to workers, I'll start work on v2. One known issue in exposing to workers is of user consent. As of now, this API does not require user consent in any of the known implementations, but it could be that some future implementations might want to gate this behind a user prompt or some such. The |
Sounds good! As for user consent: the path we've lately taken for gUM is to use the Permission API. This could be an opportunity (the page could ask for persisted permission to use getBattery which should carry over to a worker of the same origin; the worker script could check if it has permission and skip calling getBattery if not). |
That's an interesting idea. Has that been field tested with any API? Related, for permission delegation to embedded web content (in an |
Sorry to be late to the party, but experimenting a bit with this feature on Chrome and Firefox I conclude that it is not available to ServiceWorkers. I think it could be useful there (e.g. the SW script checking if resources on the server have been updated, and download only if there is plenty of battery or the charger is connected).
Has this been discussed?
The text was updated successfully, but these errors were encountered: