web api interface
BatteryManager
Secure context
The BatteryManager interface of the Battery Status API provides information about the system’s battery charge level. The getBattery() method returns a promise that resolves with a BatteryManager interface.
Since Chrome 103, the BatteryManager interface of Battery Status API only expose to secure context.
Instance properties
Also inherits properties from its parent interface, EventTarget.
chargingRead only- : A Boolean value indicating whether the battery is currently being charged.
chargingTimeRead only- : A number representing the remaining time in seconds until the battery is fully charged, or 0 if the battery is already fully charged.
dischargingTimeRead only- : A number representing the remaining time in seconds until the battery is completely discharged and the system suspends.
levelRead only- : A number representing the system’s battery charge level scaled to a value between 0.0 and 1.0.
Instance methods
Also inherits methods from its parent interface, EventTarget.
Events
Also inherits events from its parent interface, EventTarget.
chargingchange- : Fired when the battery charging state (the
chargingproperty) is updated.
- : Fired when the battery charging state (the
chargingtimechange- : Fired when the battery charging time (the
chargingTimeproperty) is updated.
- : Fired when the battery charging time (the
dischargingtimechange- : Fired when the battery discharging time (the
dischargingTimeproperty) is updated.
- : Fired when the battery discharging time (the
levelchange- : Fired when the battery level (the
levelproperty) is updated.
- : Fired when the battery level (the
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.