- From: Tran, Dzung D <dzung.d.tran@intel.com>
- Date: Wed, 30 Mar 2011 08:23:19 -0700
- To: Anssi Kostiainen <anssi.kostiainen@nokia.com>, "public-device-apis@w3.org Group WG" <public-device-apis@w3.org>
Anssi, As I reviewed the SysInfo APIs section on battery status, since I was the editor for this and I don't see much differences here. I rather that we just start with what we have in the SysInfo APIs. I could do this easily for this and all the others into mini specs. Thanks Dzung Tran -----Original Message----- From: public-device-apis-request@w3.org [mailto:public-device-apis-request@w3.org] On Behalf Of Anssi Kostiainen Sent: Thursday, March 24, 2011 7:49 AM To: public-device-apis@w3.org Group WG Subject: Battery Status Event Spec Hi, As per my ACTION-358, here's the bare bones Battery Status Event Spec to start the discussion. It is modeled on the Device Orientation Event [1]. The properties are from the SysInfo's Power [2]. ---+ Battery Status Event * The BatteryStatusEvent fires on the window object. * Registration for battery status events is achieved by calling window.addEventListener with event type "batterystatus". * The initBatteryStatusEvent() method must initialize the event in a manner analogous to the similarly-named method in the DOM Events interfaces. interface BatteryStatusEvent : Event { readonly attribute float? level; readonly attribute unsigned long? timeRemaining; readonly attribute boolean isBattery; readonly attribute boolean isCharging; void initBatteryStatusEvent(in DOMString type, in boolean bubbles, in boolean cancelable, in float level, in unsigned long timeRemaining, in boolean isBattery, in boolean isCharging); } ---+ Examples // i) repeated window.addEventListener('batterystatus', function (event) { console.log(event.level); }, true); // ii) one-shot function handler(event) { console.log(event.level); } window.addEventListener('batterystatus', handler, true); window.removeEventListener('batterystatus', handler, true); As said, this is to get the ball rolling, so let me know what you thing. If there's rough consensus I'll ReSpec this. -Anssi [1] http://dev.w3.org/geo/api/spec-source-orientation.html [2] http://dev.w3.org/2009/dap/system-info/#power
Received on Wednesday, 30 March 2011 15:31:47 UTC