Implement battery.chargingTime

RESOLVED FIXED in mozilla11

Status

()

Core
DOM
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: mounir, Assigned: mounir)

Tracking

Trunk
mozilla11
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Assignee)

Description

6 years ago
This has been added to the specs while implementing the first version of Battery API. The only issue I see with this new property is that it will tell the author whether or not the device has a battery coupled to battery.dischargingTime (both will return Infinity if there is no battery).
(Assignee)

Comment 1

6 years ago
Created attachment 572426 [details] [diff] [review]
Add .chargingTime in the DOM
Attachment #572426 - Flags: review?(jonas)
(Assignee)

Updated

6 years ago
Status: NEW → ASSIGNED
Whiteboard: [needs review]
(Assignee)

Updated

6 years ago
Blocks: 700261
Comment on attachment 572426 [details] [diff] [review]
Add .chargingTime in the DOM

Review of attachment 572426 [details] [diff] [review]:
-----------------------------------------------------------------

r=me
Attachment #572426 - Flags: review?(jonas) → review+
(Assignee)

Updated

6 years ago
Flags: in-testsuite?
Whiteboard: [needs review]
(Assignee)

Comment 3

6 years ago
Comment on attachment 572426 [details] [diff] [review]
Add .chargingTime in the DOM

This has just landed in mozilla-inbound. Requesting aurora approval for API completeness in Firefox 10. It would be better to ship Firefox 10 with the entire API if we say it is present. The risk is very low given that there is no use of the API for the moment.
Attachment #572426 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/42f490a7566a
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11

Comment 5

6 years ago
Created attachment 573723 [details]
Updated test page with new functionality

This is the test page I'm presently using (and planning to do so with our community also) to test battery api in it's most recent state.     

Implements .chargingTime and .dischargingTime

Comment 6

6 years ago
"This has been added to the specs while implementing the first version of Battery API. The only issue I see with this new property is that it will tell the author whether or not the device has a battery coupled to battery.dischargingTime (both will return Infinity if there is no battery)."

I'm not sure this is working as it should.  In my battery app (shown above) both .dischargingTime and .chargingTime show Infinity. Even though there is a battery and it's reading other values from it.  

Is there something else I must do explicitly in my JS code to couple the battery to b.dischargingTime/.chargingTime ?
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(Assignee)

Comment 7

6 years ago
Please, do not reopen a bug if you see something isn't working, open a new bug instead.

However, I believe this is working (even if not perfect). The issue is that on Android, we get a battery update every 1% change which means we have to get 2% change before being able to estimate the charging/discharging time. This can be a bit long. In addition, we do not listen to battery events when we are on background which makes thing a bit more long (and wrong sometimes).

So please, check that your level correctly increase/decrease and when you have at least 2% change, one of the dischargingTime/chargingTime values should change from Infinity to something. At least, I can confirm it's working on my phone.
Status: REOPENED → RESOLVED
Last Resolved: 6 years ago6 years ago
Resolution: --- → FIXED

Updated

6 years ago
Blocks: 702511

Comment 8

6 years ago
Comment on attachment 572426 [details] [diff] [review]
Add .chargingTime in the DOM

It looks like this feature wasn't ready for 10. Please re-nominate if you have a good justification for trying to get this into 10 rather than just waiting for 11.
Attachment #572426 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora-
You need to log in before you can comment on or make changes to this bug.