15 lines
594 B
JavaScript
15 lines
594 B
JavaScript
const { contextBridge, ipcRenderer, ipcMain } = require('electron')
|
|
const { app, BrowserWindow} = require('electron')
|
|
|
|
contextBridge.exposeInMainWorld('functions', {
|
|
node: () => process.versions.node,
|
|
chrome: () => process.versions.chrome,
|
|
electron: () => process.versions.electron,
|
|
run: (value) => ipcRenderer.invoke('run', value),
|
|
setContent: (id, value) => ipcMain.invoke(id, value),
|
|
onTaskCompleted: (callback) => ipcRenderer.on('task-completed', (_event, value) => {
|
|
callback(value)
|
|
})
|
|
// we can also expose variables, not just functions this content is priviledged
|
|
})
|