cmd-johnson / node-power-info

Cross-platform node library for accessing battery power information
https://www.npmjs.com/package/node-power-info
MIT License
3 stars 2 forks source link

Add provider using navigator.getBattery() #10

Closed cmd-johnson closed 6 years ago

cmd-johnson commented 6 years ago

As @MatthijsBlom noted in cmd-johnson/atom-battery-status#19, Atom (through Electron) as well as Browsers (Chrome and older versions of Firefox) support the Battery Status API. This API provides the navigator.getBattery() method which can be used to obtain information on the battery of the host system.

Since we're already using a multi-provider system based on availability of certain commands/APIs, we can just add another provider using this API.

This also would partially address the issue that node-power-info currently doesn't support windows.

cmd-johnson commented 6 years ago

Implemented in 4fb1e4efe8b4c454c3056440bf268e7e1add25d6