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

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

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Thu, 30 Jul 2015 10:50:26 -0400
To: Андрей Логвинов <alogvinov@yandex-team.ru>, Marcos Fábio Pereira <marcos.pereira@signove.com>
Cc: "public-device-apis@w3.org" <public-device-apis@w3.org>
Message-ID: <55BA39B2.5030507@mit.edu>
On 7/30/15 6:29 AM, Андрей Логвинов wrote:
> I may be wrong but looking at the Chromium implementation, it seems that
> the promise is used to avoid blocking or reporting out-of-thin-air
> values until the initial battery status is received from the browser
> process. After that, cached values are returned until the next status
> update is received (asynchronously).

Ah, I see.  The getters don't actually get the current information but 
whatever the information was as of the last time one of the tasks 
defined in 
http://www.w3.org/TR/battery-status/#the-batterymanager-interface ran...

I guess that makes sense, as long as you don't care about the current 

Received on Thursday, 30 July 2015 14:51:04 UTC

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