Skip to content

Commit

Permalink
battery: show UNK if battery timing data is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Dec 20, 2017
1 parent 0a99b3c commit 98e1746
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/battery/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ module.exports = block({
run (b, options) {
getBattery().then((list) => list[0]).then((battery) => {
if (battery.state === 'charging') {
b.update(`🗲 ${battery.percentage} ${battery.timeToFull}`)
b.update(`🗲 ${battery.percentage} ${battery.timeToFull || 'UNK'}`)
} else if (battery.state === 'discharging') {
b.update(`🔋 ${battery.percentage} ${battery.timeToEmpty}`)
b.update(`🔋 ${battery.percentage} ${battery.timeToEmpty || 'UNK'}`)
} else if (battery.state === 'fully-charged') {
b.update('🔋 100%')
}
Expand Down

0 comments on commit 98e1746

Please sign in to comment.