capacitor-community / electron

Deploy your Capacitor apps to Linux, Mac, and Windows desktops, with the Electron platform! 🖥️
https://capacitor-community.github.io/electron/
MIT License
318 stars 58 forks source link

IPC Renderer VueJs #210

Closed kieranbarlow closed 1 year ago

kieranbarlow commented 1 year ago

I am an old timer in regards to using Electron v2, I've not looked at Electron for some time and I am now getting back into it.

I have an Ionic Capacitor project running VueJs and I was hoping to communicate from a component by importing IPC Renderer but unfortunately, I'm getting nowhere.

This is how I use to do it many days ago, could someone point me in the right direction?

ComponentName.vue

import { ipcRenderer } from 'electron';

sendCommand() {
   ipcRenderer.send('do-something', 'hello world');
}
background.js

import { app, ipcMain } from 'electron'

ipcMain.on('do-something', (event,arg) => {
 console.log(arg);
});