W3C home > Mailing lists > Public > public-device-apis@w3.org > July 2015

Re: Trying to understand the Promise usage in the battery API

From: Marcos Fábio Pereira <marcos.pereira@signove.com>
Date: Wed, 29 Jul 2015 16:46:54 -0300
Message-ID: <CAG_XX+5oi4trtg708WFaPbrW4BxbsmHXVnV5gSmDvR33_dZyfA@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "public-device-apis@w3.org" <public-device-apis@w3.org>
I think it is just to make it compliance with ES6 and most hardware
implementation as possible.

Maybe in the future some hardware implementation needs some time to
retrieve the battery level and create the instance of BatteryManager in
the first call of getBattery().


2015-07-29 14:27 GMT-03:00 Boris Zbarsky <bzbarsky@mit.edu>:

> I was asked to review a patch to Gecko to align our implementation of the
> battery API to http://www.w3.org/TR/2014/CR-battery-status-20141209/ and
> I'm not sure I understand the intent of the Promise usage in that
> specification.
> The Promise just returns a manager object; this doesn't particularly need
> to be an async operation (though it can be one, of course).  But all the
> operations for querying the actual hardware state are then synchronous, and
> _those_ are what I would expect one might want to do asynchronously.
> I looked through the list archives, but can't seem to find the rationale
> for the current design; if there is one there, I would appreciate a pointer
> to it.
> Thanks,
> Boris

Marcos Fábio Pereira
Received on Wednesday, 29 July 2015 19:47:22 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:33:22 UTC