battery-manager

1.1.1 • Public • Published

How to install?

Just add battery-manager to your project via npm or yarn or pnpm. It helps you to check the client battery level using Web Battery API.

pnpm add battery-manager

Then it is ready to use example app:

import BatteryManager from 'battery-manager';


const manager = new BatteryManager({
    onChargingChange: (isCharging) => { console.log(`Your laptop is ${isCharging ? 'charging' : 'not charging'}`) },
    onLevelChange: (level) => { console.log(`Your laptop battery is ${level * 100}`) },
})
console.log('hello dude!');

Readme

Keywords

none

Package Sidebar

Install

npm i battery-manager

Weekly Downloads

1

Version

1.1.1

License

ISC

Unpacked Size

2.7 kB

Total Files

4

Last publish

Collaborators

  • sbayd