Re: Feedback about Battery Status Events

On Mon, Oct 24, 2011 at 12:18 AM, Anssi Kostiainen
<anssi.kostiainen@nokia.com> wrote:
> On 22.10.2011, at 5.11, ext Jonas Sicking wrote:
>
>> Further, if we expose remaining time, the page would be able to notice
>> that it's non-infinite (or whatever other value we use to signal that
>> battery level won't run out).
>
> The latest spec says:
>
> [[
>
> The [remaining] attribute must be set to the value positive Infinity, if the implementation is unable to report the time remaining, or there is no battery attached to the system."
>
> ]]
>
> For example:
>
> if (navigator.battery.remaining < Infinity) {
>  // non-infinite time remaining
> }
>
> Let me know if there are concerns with this.

It should also return Infinity if the device is plugged in and
actually charging (i.e. power usage is lower than power supplied),
right?

/ Jonas

Received on Monday, 24 October 2011 07:22:54 UTC