Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions extensions/vscode/src/util/battery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export class Battery implements Disposable {
private readonly onChangeLevelEmitter = new EventEmitter<number>();
private acConnected: boolean = true;
private level = 100;
private readonly batteryStatsPromise = si.battery();

constructor() {
this.updateTimeout = setInterval(() => this.update(), UPDATE_INTERVAL_MS);
Expand All @@ -22,7 +21,7 @@ export class Battery implements Disposable {
}

private async update() {
const stats = await this.batteryStatsPromise;
const stats = await si.battery();
const level = stats.hasBattery ? stats.percent : 100;
const isACConnected =
!stats.hasBattery || stats.acConnected || level == 100;
Expand Down
Loading