Skip to content

Commit

Permalink
Added full batteryState, and chargingtime/dischargingtime
Browse files Browse the repository at this point in the history
  • Loading branch information
robertherber authored and mikehardy committed Nov 10, 2019
1 parent 86ee3cb commit 692c50e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions web/index.js
Expand Up @@ -7,10 +7,14 @@ let isBatteryCharging = false,
powerState = {};

const getPowerState = battery => {
const { level, charging, chargingtime, dischargingtime } = battery;

return {
batteryLevel: battery.level,
batteryLevel: level,
lowPowerMode: false,
batteryState: battery.charging ? 'charging' : 'unplugged',
batteryState: level === 1 ? 'full' : charging ? 'charging' : 'unplugged',
chargingtime,
dischargingtime,
};
};

Expand Down

0 comments on commit 692c50e

Please sign in to comment.