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

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().

Br,
Marcos

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