BatteryManager Class
The battery status of the device (https://w3c.github.io/battery/#the-batterymanager-interface), returned by Navigator.GetBattery: it is read from the BatteryStatusProvider of the browsing context (BatteryStatusOptions.Provider), and fires the chargingchange, chargingtimechange, dischargingtimechange and levelchange events when it changes, while its document is visible.
public sealed class BatteryManager : EventTarget- Inheritance
EventTargetBatteryManager
Properties
| Name | Description |
|---|---|
| Charging | Gets whether the battery is charging (or there is no battery). |
| ChargingTime | Gets the remaining time in seconds until the battery is fully charged (0 when it is full), or positive infinity. |
| DischargingTime | Gets the remaining time in seconds until the battery is depleted, or positive infinity. |
| Level | Gets the level of the battery, between 0 and 1, rounded to two decimals. |
| OnChargingChange | Gets or sets the event handler of the chargingchange event. |
| OnChargingTimeChange | Gets or sets the event handler of the chargingtimechange event. |
| OnDischargingTimeChange | Gets or sets the event handler of the dischargingtimechange event. |
| OnLevelChange | Gets or sets the event handler of the levelchange event. |
Charging
BatteryStatus.csGets whether the battery is charging (or there is no battery).
public bool Charging { get; }ChargingTime
BatteryStatus.csGets the remaining time in seconds until the battery is fully charged (0 when it is full), or positive infinity.
public double ChargingTime { get; }DischargingTime
BatteryStatus.csGets the remaining time in seconds until the battery is depleted, or positive infinity.
public double DischargingTime { get; }Level
BatteryStatus.csGets the level of the battery, between 0 and 1, rounded to two decimals.
public double Level { get; }OnChargingChange
BatteryStatus.csGets or sets the event handler of the chargingchange event.
Property value
See also
OnChargingTimeChange
BatteryStatus.csGets or sets the event handler of the chargingtimechange event.
Property value
See also
OnDischargingTimeChange
BatteryStatus.csGets or sets the event handler of the dischargingtimechange event.
Property value
See also
OnLevelChange
BatteryStatus.csGets or sets the event handler of the levelchange event.