- From: Dominique Hazael-Massieux <dom@w3.org>
- Date: Fri, 09 Sep 2011 08:46:14 +0200
- To: Anssi Kostiainen <anssi.kostiainen@nokia.com>
- Cc: "public-device-apis@w3.org WG" <public-device-apis@w3.org>, ext Anne van Kesteren <annevk@opera.com>
Le vendredi 09 septembre 2011 à 09:01 +0300, Anssi Kostiainen a écrit :
> Here's a summary of discussed alternatives:
>
> var b = new BatteryStatusEventSource();
> b.onbatterystatus = function () {};
>
> navigator.battery.start();
> navigator.battery.onbatterystatus = function () {};
>
> var b = navigator.getBattery();
> b.onbatterystatus = function () {};
>
> Which one is your favorite, and why?
I think the last one is probably my favorite, but mostly for cosmetic
reason: it doesn't add a constructor (which for a singleton seems
awkward), and it doesn't need the start() method (which reads weird: it
feels like you're starting the battery itself).
Dom
Received on Friday, 9 September 2011 06:46:36 UTC