Skip to content

fix: use powerMonitor.on() only after app is ready#21942

Merged
codebytere merged 4 commits into8-x-yfrom
trop/8-x-y-bp-fix-use-powermonitor-on-only-after-app-is-ready-1580235600376
Jan 28, 2020
Merged

fix: use powerMonitor.on() only after app is ready#21942
codebytere merged 4 commits into8-x-yfrom
trop/8-x-y-bp-fix-use-powermonitor-on-only-after-app-is-ready-1580235600376

Conversation

@trop
Copy link
Contributor

@trop trop bot commented Jan 28, 2020

Backport of #21927

See that PR for details.

Notes: Fixed error thrown when importing powerMonitor on Linux before app's 'ready' event.

ckerr added 4 commits January 28, 2020 18:20
powerMonitor can't be used until the app is ready; however, on Linux,
powerMonitor.on() was called as soon as lib/browser/api/power-monitor.ts
was loaded.

This patch takes @vladimiry's suggestion of wrapping that in an
app.on('ready') handler to prevent powerMonitor.on() from being called
prematurely.

Fixes #21716
Fix the previous commit's app-is-ready handler by checking to see if
app is already ready when power-monitor.ts is loaded.
@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Jan 28, 2020
@trop trop bot requested a review from ckerr January 28, 2020 18:20
@trop trop bot added 8-x-y backport This is a backport PR labels Jan 28, 2020
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Jan 28, 2020
@codebytere codebytere merged commit 83c4633 into 8-x-y Jan 28, 2020
@release-clerk
Copy link

release-clerk bot commented Jan 28, 2020

Release Notes Persisted

Fixed error thrown when importing powerMonitor on Linux before app's 'ready' event.

@codebytere codebytere deleted the trop/8-x-y-bp-fix-use-powermonitor-on-only-after-app-is-ready-1580235600376 branch January 28, 2020 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8-x-y backport This is a backport PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants