Skip to content
Small library providing information about the device's battery status
JavaScript HTML
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
demo
tests
.gitignore
.travis.yml
Gruntfile.js
LICENSE
README.md
Voltage.js
bower.json
package.json

README.md

Voltage.js

Small library providing information about the device's battery status

Usage

Get battery level

Voltage.getLevel(callback);

Is battery charging?

Voltage.isCharging(callback);

Get charging time

Voltage.getChargingTime(callback);

Get discharging time

Voltage.getDischargingTime(callback);

Quick example

The functions are asynchronous so you need to use a callback:

Voltage.getLevel(
    function (level) {
        console.log(level);
    }
);

Credits

The demo uses Firefox OS Gaia Icons.

Something went wrong with that request. Please try again.