[Vuejs]-How to create BrowserWindow with data, and get that data in vue app?

0👍

You can pass any data you want via IPC:

Here is an example:

// In main process.
const { ipcMain } = require('electron')

ipcMain.on('hey', (event, arg) => {
  console.log('hey from win', arg) // prints "{a: 2}" in main process console
})

// send message to your window when it ready (win is your window)
win.webContents.send('hi', {data: 'is here'})
import { ipcRenderer } from 'electron'

ipcRenderer.on('hi', (e, payload) => {
  console.log('hi from main', payload) // prints: {data: 'is here'} in dev tools
})
    
ipcRenderer.send('hey', 'ping', {a: 2})

Leave a comment