Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: allow requiring modules with no side effects #17496

Merged
merged 1 commit into from Apr 30, 2019

Conversation

@codebytere
Copy link
Member

codebytere commented Mar 21, 2019

Description of Change

Resolves #16168.

This creates and returns a proxy object when modules that can't be used before app ready are required such an instance of is no longer created at require-time and only when a method is called.

Checklist

Release Notes

Notes: Fixed an issue whereby requiring some modules before the app ready event had side effects.

@codebytere codebytere force-pushed the screen-spike branch from 90f8ad6 to 9284770 Mar 21, 2019
@codebytere codebytere requested review from zcbenz and MarshallOfSound Mar 21, 2019
@codebytere codebytere force-pushed the screen-spike branch 3 times, most recently from 27bf67f to 8a78b09 Mar 21, 2019
@codebytere codebytere requested a review from felixrieseberg Mar 21, 2019
@codebytere codebytere force-pushed the screen-spike branch from 8a78b09 to ce89446 Mar 21, 2019
@codebytere codebytere changed the title refactor: allow requiring screen module before app ready refactor: allow requiring module before app ready with no side effets Mar 21, 2019
@codebytere codebytere changed the title refactor: allow requiring module before app ready with no side effets refactor: allow requiring modules with no side effects Mar 21, 2019
@codebytere codebytere force-pushed the screen-spike branch 2 times, most recently from 1206714 to 0a4354f Mar 21, 2019
@electron-cation electron-cation bot removed the new-pr 🌱 label Mar 22, 2019
@codebytere codebytere force-pushed the screen-spike branch 2 times, most recently from 1f1b8a3 to 34b50f6 Mar 22, 2019
@codebytere codebytere requested a review from MarshallOfSound Mar 22, 2019
@codebytere codebytere force-pushed the screen-spike branch from 34b50f6 to 4cf986e Mar 22, 2019
Copy link
Member

MarshallOfSound left a comment

Approach seems good, nice catch on the docs missing 👍

Just some TS / styling comments

lib/browser/utils.ts Show resolved Hide resolved
lib/browser/utils.ts Show resolved Hide resolved
lib/browser/api/power-monitor.ts Show resolved Hide resolved
lib/browser/api/power-monitor.ts Show resolved Hide resolved
@codebytere codebytere requested a review from MarshallOfSound Apr 2, 2019
lib/browser/utils.ts Outdated Show resolved Hide resolved
@codebytere codebytere force-pushed the screen-spike branch from a21ece4 to 04a1fc7 Apr 2, 2019
@codebytere codebytere requested a review from MarshallOfSound Apr 2, 2019
* @returns {Object} - a proxy object for the
*/

export function createLazyInstance (

This comment has been minimized.

Copy link
@miniak

miniak Apr 9, 2019

Contributor

could we maybe use an ES6 Proxy?

This comment has been minimized.

Copy link
@codebytere

codebytere Apr 29, 2019

Author Member

probably not unfortunately, the intricacies of doing that correctly would introduce far more space for potential issues

This comment has been minimized.

Copy link
@zcbenz

zcbenz Apr 30, 2019

Member

The remote module does not work very well with ES6 Proxy objects.

@zcbenz
zcbenz approved these changes Apr 30, 2019
@zcbenz zcbenz merged commit 7b55ee9 into master Apr 30, 2019
15 checks passed
15 checks passed
Artifact Comparison Changes Detected
Details
Semantic Pull Request ready to be squashed
Details
WIP Ready for review
Details
appveyor: win-ia32-debug AppVeyor build succeeded
Details
appveyor: win-ia32-testing AppVeyor build succeeded
Details
appveyor: win-ia32-testing-pr AppVeyor build succeeded
Details
appveyor: win-x64-debug AppVeyor build succeeded
Details
appveyor: win-x64-testing AppVeyor build succeeded
Details
appveyor: win-x64-testing-pr AppVeyor build succeeded
Details
build-linux Workflow: build-linux
Details
build-mac Workflow: build-mac
Details
electron-arm-testing Build #20190402.33 succeeded
Details
electron-arm64-testing Build #20190402.33 succeeded
Details
lint Workflow: lint
Details
release-notes Release notes found
@release-clerk

This comment has been minimized.

Copy link

release-clerk bot commented Apr 30, 2019

Release Notes Persisted

Fixed an issue whereby requiring some modules before the app ready event had side effects.

@zcbenz zcbenz deleted the screen-spike branch Apr 30, 2019
Kiku-Reise added a commit to Kiku-Reise/electron that referenced this pull request May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.