Mozilla has a rather ambitious plan with WebAPI, it wants to enable web apps to leverage capabilities and features exclusive to native apps so far. The idea is to enable applications built with web technologies to access features such as a phone's dialer, the accelerometer or even battery status.
It's part of the greater Boot to Gecko project, but the API should benefit all web applications regardless of platform, as long as it is implemented.
Development on the WebAPI is coming along nicely, several of its components are already built with others on the way. The Battery API, for example, can already be tested.
"Detecting battery level in a device or computer can help you inform the user of the current status. Within Mozilla’s WebAPI, we have the Battery API to offer that possibility," Mozilla
explained.
The full code for testing the feature is available in the post. The feature works in Firefox for Android, only in the Aurora, for Windows and for Linux.