mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-12-27 02:23:28 +08:00
[local-sync] Set isBatteryCharging on startup
Summary: Previously we just assumed that we were in the "charging" state and wouldn't update that until the state changed. This would cause us to throttle even if the app was opened while plugged in. Now we don't do that. Test Plan: Run locally, verify that we no longer throttle Reviewers: spang, evan, juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3782
This commit is contained in:
parent
c097a86169
commit
7ad9e36cec
1 changed files with 1 additions and 0 deletions
|
@ -26,6 +26,7 @@ class MessageProcessor {
|
||||||
this._currentChunkStart = Date.now();
|
this._currentChunkStart = Date.now();
|
||||||
this._isBatteryCharging = true;
|
this._isBatteryCharging = true;
|
||||||
navigator.getBattery().then((battery) => {
|
navigator.getBattery().then((battery) => {
|
||||||
|
this._isBatteryCharging = battery.charging;
|
||||||
battery.addEventListener('chargingchange', () => {
|
battery.addEventListener('chargingchange', () => {
|
||||||
console.info('charge change', battery.charging);
|
console.info('charge change', battery.charging);
|
||||||
this._isBatteryCharging = battery.charging
|
this._isBatteryCharging = battery.charging
|
||||||
|
|
Loading…
Reference in a new issue