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

RE: [battery] Should getBattery() always return the same promise?

From: Domenic Denicola <domenic@domenicdenicola.com>
Date: Tue, 1 Jul 2014 21:27:04 +0000
To: Rick Waldron <waldron.rick@gmail.com>, Mounir Lamouri <mounir@lamouri.fr>
CC: public-device-apis <public-device-apis@w3.org>
Message-ID: <1404250025736.37964@domenicdenicola.com>
From: Rick Waldron <waldron.rick@gmail.com>

> Is there a design history document or thread that explains the reasoning that lead to an API that returns a promise here? The battery exists before the browser ever loads a site and its JavaScript files, so why does `getBattery` need to be a promise?

This is a great point, and a non-normative note would be helpful. My assumption was that it was so you could lazy-load battery-related code, or perhaps that battery information is stored out of process and thus some asynchronous prep-work must be done to make it available. I have no idea though and some help from implementers would be great.
Received on Tuesday, 1 July 2014 21:27:37 UTC

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