jooy2 / vutron

💚 Quick Start Templates for Vite + Electron + Vue 3 + Vuetify + TypeScript. Vutron is a preconfigured template for developing Electron cross-platform desktop apps. It uses Vue 3 and allows you to build a fast development environment with little effort.
https://vutron.cdget.com
MIT License
253 stars 21 forks source link

Remove SendSync (see Electron docs) #181

Closed lnrdnl closed 8 months ago

lnrdnl commented 8 months ago

I removed sendSync. Electron docs says you should not use it. Use invoke instead:

See https://www.electronjs.org/docs/latest/tutorial/ipc#using-ipcrenderersendsync

The structure of this code is very similar to the invoke model, but we recommend avoiding this API for performance reasons. Its synchronous nature means that it'll block the renderer process until a reply is received.

I also implemented an invoke example in which you can submit a message (request).

Also I implemented logging to console which helps debugging the communication.

jooy2 commented 8 months ago

Hello, thank you for using the Vutron template and contributing to the work.

The sendSync in your example isn't causing any serious performance degradation, but I agree with replacing it with invoke as it can be confusing to use in the template, and I think the functionality works well enough to replace the existing code.

There are a few things missing (translation keys), but I'll work on that further, and I'll merge this PR.

Thanks a lot!