[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:
Mark Hahnenberg 2017-01-25 13:50:16 -08:00
parent c097a86169
commit 7ad9e36cec

View file

@ -26,6 +26,7 @@ class MessageProcessor {
this._currentChunkStart = Date.now();
this._isBatteryCharging = true;
navigator.getBattery().then((battery) => {
this._isBatteryCharging = battery.charging;
battery.addEventListener('chargingchange', () => {
console.info('charge change', battery.charging);
this._isBatteryCharging = battery.charging