Closed Bug 699743 Opened 13 years ago Closed 13 years ago

Implement battery.chargingTime

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla11

People

(Reporter: mounir, Assigned: mounir)

References

Details

Attachments

(2 files)

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).
Attachment #572426 - Flags: review?(jonas)
Status: NEW → ASSIGNED
Whiteboard: [needs review]
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+
Flags: in-testsuite?
Whiteboard: [needs review]
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
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
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
"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 → ---
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
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
Blocks: 702511
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-
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: