workflow_launcher/preload.js
2024-05-06 07:03:04 +02:00

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)
})
})