workflow_launcher/preload.js

15 lines
594 B
JavaScript
Raw Normal View History

2024-03-11 11:01:07 -04:00
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
})