From 7ad9e36cec36207c48153279815d43e07cc7333a Mon Sep 17 00:00:00 2001 From: Mark Hahnenberg Date: Wed, 25 Jan 2017 13:50:16 -0800 Subject: [PATCH] [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 --- packages/local-sync/src/message-processor/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/local-sync/src/message-processor/index.js b/packages/local-sync/src/message-processor/index.js index f374dc179..18aa3efa2 100644 --- a/packages/local-sync/src/message-processor/index.js +++ b/packages/local-sync/src/message-processor/index.js @@ -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