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 use case / motivation / explanation to readme #46

Open
vjpr opened this issue May 11, 2022 · 1 comment
Open

Add use case / motivation / explanation to readme #46

vjpr opened this issue May 11, 2022 · 1 comment

Comments

@vjpr
Copy link

vjpr commented May 11, 2022

Why is this needed instead of just using child_process('electron', {stdio: 'pipe'}).on('data', () => {})?

I assume its because child.send wouldn't work.


From initial glance I thought you were overriding some require('electron') stuff, but the Electron class is just a wrapper.

Looks like it just overrides console in the renderer (preload.js) to send those messages to the main process (runner.js), which then sends them back to the node script via stdio: ipc process.send.

@vjpr vjpr changed the title Add use case / motivation to readme Add use case / motivation / explanation to readme May 11, 2022
@juliangruber
Copy link
Owner

This module lets you feed JS to a hidden browser, and returns the browser's console output. The difference to your example is that it doesn't execute it in the main process, but in the renderer process, where you have access to the DOM and all browser JS APIs. Does that answer your question?

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

No branches or pull requests

2 participants