I am having a hard time googling how I would do multi-threading if I made an electron app. Would it be with web workers?
In the renderer process you can create Web Workers, and those will run in their own threads, however Node integration will be disabled in those Web Workers because Node isn't thread-safe. So if you want to run something in a separate thread that uses Node then you'll need to spawn a separate process, you can do so with child_process.fork()
and then communicate with the new process using send()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With