Confirmed users
368
edits
(→Demo) |
(→Proposed API: Update the proposed api to match what we actually did) |
||
Line 22: | Line 22: | ||
readonly attribute boolean charging; | readonly attribute boolean charging; | ||
readonly attribute float level; | readonly attribute float level; | ||
attribute Function? onchargingchange; | attribute Function? onchargingchange; | ||
attribute Function? onlevelchange; | attribute Function? onlevelchange; | ||
} | } | ||
The charging attribute will return true if the device is currently charging and false otherwise. True if there is no battery or if this information is not available.<br> | |||
The level attribute will return the current battery level of the device from 0.0 to 1.0. 1.0 if there is no battery or if this information is not available.<br> | |||
The charging attribute will return true if the device is currently charging and false otherwise.<br> | |||
The level attribute will return the current battery level of the device from 0.0 to | |||
The following events can be sent to the mozBattery object: | The following events can be sent to the mozBattery object: | ||
''chargingchange'': when the charging state changes; | ''chargingchange'': when the charging state changes; | ||
''levelchange'': when the level value changes of at least | ''levelchange'': when the level value changes of at least 0.01; | ||
== Considered changes == | == Considered changes == |