Re: [battery] getBattery() vs. requestBattery() pattern

On Tue, Jul 1, 2014 at 4:54 PM, Domenic Denicola <> wrote:

> The spec says
> > The user agent SHOULD NOT reject the promise returned by getBattery().
> If the user agent does not want to expose the battery information to the
> web page, it is RECOMMENDED to not expose getBattery() or resolve the
> promise with an instance of BatteryManager exposing only default values.
> I think there has been an increasing push to make APIs use a
> requestAccessToX().then(gotAccess, didntGetAccess) style. Alex, CC'ed, has
> some reasons why this is a good pattern in general; if I recall they are
> around how it enables a better permissions model for apps. (I hope he can
> explain better.)
> But just from a consistency point of view, it would make more sense to me
> to converge.
> I realize that the default values idea might have been a result of a
> previous discussion that I missed, and would be happy to be pointed toward
> it. The "not expose getBattery()" part is kind of funny, as the spec is
> RECOMMENDing that implementations not comply with the spec :P

The Battery Status API doesn't require user permission to access the


Received on Tuesday, 1 July 2014 21:19:42 UTC