BatteryManager interface provides ways to get information about the system's battery charge level.
navigator.getBattery() method returns a battery promise that is resolved in a
BatteryManager interface which you can use to interact with the Battery Status API.
A Boolean value indicating whether or not the battery is currently being charged.
A number representing the remaining time in seconds until the battery is fully charged, or 0 if the battery is already fully charged.
A number representing the remaining time in seconds until the battery is completely discharged and the system will suspend.
A number representing the system's battery charge level scaled to a value between 0.0 and 1.0.
BatteryManager.healthAvailable since v2.5 The health status of battery.
BatteryManager.presentAvailable since v2.5 A Boolean value indicating whether or not the battery is present
BatteryManager.temperatureAvailable since v2.5 A number representing the temperature of battery.
BatteryManager.onbatteryhealthchangeAvailable since v2.5 A handler for the batteryhealthchange event; This event is sent when the battery health is updated.
A handler for the chargingchange event; This event is sent when the battery charging state is updated.
A handler for the chargingtimechange event; This event is sent when the battery charging time is updated
A handler for the dischargingtimechange event; This event is sent when the battery discharging time is updated.
A handler for the levelchange event; This event is sent when the battery level is updated.
Register an event handler of a specific event type on the EventTarget.
Removes an event listener from the EventTarget.
Dispatch an event to this EventTarget.
Additional methods for Mozilla chrome code
- void setEventHandler(DOMString type, EventHandler handler)
- EventHandler getEventHandler(DOMString type)
Mozilla extensions for use by JS-implemented event targets to implement on* properties. See also WebIDL bindings.