14 lines
512 B
JavaScript
14 lines
512 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)
|
||
|
})
|
||
|
})
|