September 2024
Beginner to intermediate
985 pages
35h 37m
English
Via the Battery Status API (www.w3.org/TR/battery-status/), it’s possible to access battery information of an end device and thus, for example, adapt a web page accordingly depending on the charging status of the battery. For this purpose, the API defines the BatteryManager interface, which can be used to access various pieces of battery information. Access to an object instance of the BatteryManager type is obtained via the (also new) getBattery() method of the navigator object.
The BatteryManager interface provides four properties (see Table 12.9). The charging property (of the boolean type) provides information about whether the battery is currently ...
Read now
Unlock full access