- From: Marcos Caceres <w3c@marcosc.com>
- Date: Wed, 30 Apr 2014 17:07:12 -0400
- To: Tim Volodine <timvolodine@google.com>, public-device-apis@w3.org
On April 30, 2014 at 8:35:19 AM, Tim Volodine (timvolodine@google.com) wrote:
> We are proposing a change to the current Battery Status API (
> http://www.w3.org/TR/battery-status/) 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