Re: Battery Status API asynchronous amendment

On April 30, 2014 at 8:35:19 AM, Tim Volodine ( wrote:
> We are proposing a change to the current Battery Status API (
> such that it is completely
> asynchronous. This will allow for less constrained and more efficient
> current and future implementations.
> More concretely the proposal is to return the battery object asynchronously
> as a promise, e.g.
> function onBatterySuccess(battery) {
> console.log(batery.level);
> }
> function onBatteryFailure(msg) {
> console.log("battery information not available");
> }
> navigator.getBattery().then(onBatterySuccess, onBatteryFailure);

Maybe getBattery() could resolve to an array... might avoid issues down the road if any device ships with multiple batteries. 

> Mozilla who has the only browser currently shipping the Battery Status API
> has indicated that they would be fine with such change. 

Just out of interest, do you have a pointer as to who from Moz said the change would be ok? 

Marcos Caceres

Received on Wednesday, 30 April 2014 21:07:41 UTC