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

Add Platform API and babel plugin #26

Merged
merged 9 commits into from
Feb 26, 2022
Merged

Conversation

hans00
Copy link
Contributor

@hans00 hans00 commented Feb 14, 2022

As title.

In my case.
We need know which OS instead just web
And considered #5 , I move it to nativeOS

Copy link
Owner

@PaulLeCam PaulLeCam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR!
I left a few comments.

plugin.js Outdated Show resolved Hide resolved
src/preload.ts Outdated Show resolved Hide resolved
src/preload.ts Outdated
platform,
}

try {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change please?

Copy link
Contributor Author

@hans00 hans00 Feb 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our case, we implemented the node integration without context isolation.
So I add the auto fallback.

Or you suggest us refactor?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that context isolation is ennabled default in Electron now, I haven't seen docs about injecting globals when context isolation is disabled?
Basically, I don't want to rely on undefined Electron behavior for injecting these APIs. If the way you changed it is recommended or at least documented by Electron that's fine, but otherwise I'd rather only use the contextBridge API.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my test. Disable the context isolation, contextBridge.exposeInMainWorld will throw error.
Error: contextBridge API can only be used when contextIsolation is enabled

README.md Outdated Show resolved Hide resolved
Copy link
Owner

@PaulLeCam PaulLeCam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

@PaulLeCam PaulLeCam merged commit a60f0f9 into PaulLeCam:master Feb 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants