From Tutorialzine –Quick Tip: Working with the JavaScript Battery API:
We take a look at a native JavaScript API for monitoring battery levels. We also discuss some of the biggest battery drainers, as well as different ways to minimize excess energy spending.