API Documentation

for 0.0.1
Show:

BatteryStatus Class

Component to monitor battery status changes

Methods

getChargingTime

() Number

Get the time remaining until the battery is fully charge The component needs to be activated before using this method

Returns:

Number:

The remaining time in seconds until the battery is fully charged, or 0 if the battery is already fully charged

getDischargingTime

() Number

Get the time remaining until the battery is completely discharged The component needs to be activated before using this method

Returns:

Number:

The remaining time in seconds until the battery is completely discharged and the system will suspend

getLevel

() Number

Get the battery's charge level The component needs to be activated before using this method

Returns:

Number:

The charge level on a scale from 0.0 to 1.0

isCharging

() Boolean

Check if the battery is currently charging The component needs to be activated before using this method

Returns:

Boolean:

True if charging, false otherwise

onBatteryManager

(
  • manager
)
private

battery API promise callback Adds event listeners on the battery manager

Parameters:

onChargingChange

() private

chargingchange event handler Fires a chargingchange event

onChargingTimeChange

() private

chargingtimechange event handler Fires a chargingtimechange event

onDischargingTimeChange

() private

levelchange event handler Fires a levelchange event

onLevelChange

() private

dischargingtimechange event handler Fires a dischargingtimechange event

Events

chargingchange

Fired when charging state changed

chargingtimechange

Fired when charging time changed

dischargingtimechange

Fired when discharging time changed

levelchange

Fired when charge level changed