Deluze / electron-vue-template

Simple Vue3 + Electron starter template in TypeScript, including ViteJS and Electron Builder
MIT License
534 stars 104 forks source link

Can we add IPC practice in this template? #50

Closed PublicWorld closed 11 months ago

PublicWorld commented 1 year ago

Hi Deluze, I'd love this template so much! But I'd like to see how to multithread time-consuming tasks based on this template. Do you have any more examples?

Deluze commented 11 months ago

If you want to do some multi threading, you can spawn some worker threads after an IPC event.

Like so:

ipcMain.on('start-big-task', () => {
  const worker = new Worker('path_to_big_task.js', { someData: 42 });
});

This example is independent of this template though. I'd recommend looking into Worker Threads.