batteryManager
#
DescriptionThe BatteryManager
interface provides ways to get information about the system's battery charge level.
The 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.
#
PropertiesBatteryManager.charging
read-only
A Boolean value indicating whether or not the battery is currently being charged.BatteryManager.chargingTime
read-only
A number representing the remaining time in seconds until the battery is fully charged, or 0 if the battery is already fully charged.BatteryManager.dischargingTime
read-only
A number representing the remaining time in seconds until the battery is completely discharged and the system will suspend.BatteryManager.level
read-only
A number representing the system's battery charge level scaled to a value between 0.0 and 1.0.BatteryManager.health
read-only
Available since v2.5 The health status of battery.BatteryManager.present
read-only
Available since v2.5 A Boolean value indicating whether or not the battery is presentBatteryManager.temperature
read-only
Available since v2.5 A number representing the temperature of battery.
#
Event HandlersBatteryManager.onbatteryhealthchange
Available since v2.5 A handler for the batteryhealthchange event; This event is sent when the battery health is updated.BatteryManager.onchargingchange
A handler for the chargingchange event; This event is sent when the battery charging state is updated.BatteryManager.onchargingtimechange
A handler for the chargingtimechange event; This event is sent when the battery charging time is updatedBatteryManager.ondischargingtimechange
A handler for the dischargingtimechange event; This event is sent when the battery discharging time is updated.BatteryManager.onlevelchange
A handler for the levelchange event; This event is sent when the battery level is updated.
#
MethodsInherited from EventTarget
:
EventTarget.addEventListener()
Register an event handler of a specific event type on the EventTarget.EventTarget.removeEventListener()
Removes an event listener from the EventTarget.EventTarget.dispatchEvent()
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.