W3C home > Mailing lists > Public > public-device-apis@w3.org > April 2012

Re: Battery Status API changes since the last publication

From: Marcos Caceres <w3c@marcosc.com>
Date: Mon, 16 Apr 2012 10:39:55 +0100
To: Anssi Kostiainen <anssi.kostiainen@nokia.com>
Cc: "public-device-apis public-device-apis@w3.org" <public-device-apis@w3.org>
Message-ID: <269B0BF9D45C41F7AD6242631660090A@marcosc.com>

On Monday, 16 April 2012 at 09:03, Anssi Kostiainen wrote:

> Hi,
> We're advancing the Battery Status API [1] to Candidate Recommendation, and this is the required (by the W3C Process) public documentation of all the changes since the previous publication, W3C Working Draft 29 November 2011 [2]:
> Substantive changes:
> - Added a Terminology section.
> - Added a Security and privacy considerations section.
> - Defined that the events are queued using the task queue defined in HTML5.
> - Added [TreatNonCallableAsNull] keywords to on* handlers.

Note that [TreatNonCallableAsNull] is still in flux in WebIDL. I strongly recommend emailing the WebIDL list about this for guidance before proceeding (might save a bit of a headache later). Event handlers may end up being defined in DOM4.  
> - Dropped 'full' from the true condition for the charging attribute.
> - Fixed two substantial typos (s/dischargingchange/dischargingtimechange/g) in the Event handlers section.

If no one noticed this for a long time, then that is a pretty strong indicator that the event name is not memorable… bike shed discussion, I know… but the event names are not ideal IMO.   

(I'm sure the following has been raised before, but I'm new to this list so apologies for redundancy… if there is a link to the discussion in the archive, please point me to it)

I'll note that it seems pretty extreme to have four different event registers that basically do the same thing: detecting a change in charge. Why don't you merge them into a "onchange" attribute? Also, the spec says that BatteryManager is an EventHandler, yet no events are fired at it (that seems wrong - event handlers need to have events fired at them)?  

This pattern is not ideal IMO:

navigator.battery.onlevelchange = function () {

This would be better (i.e., use and event):

navigator.battery.onchange = function (e) {

> Minor changes:
> - Conformance requirements with respect to the attributes were merged.
> - Separated event handlers from attributes to their own Event handles section.
> - Added proper acknowledgements.
> For detailed change logs, see [3,4].
> -Anssi
> [1] http://dvcs.w3.org/hg/dap/raw-file/tip/battery/Overview.html
> [2] http://www.w3.org/TR/2011/WD-battery-status-20111129/
> [3] http://dvcs.w3.org/hg/dap/log/bf66d314a3bb/battery/Overview.html
> [4] http://dev.w3.org/cvsweb/2009/dap/system-info/battery-status.html
Received on Monday, 16 April 2012 09:40:34 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 14:53:53 UTC