workflow_launcher/main.js
2024-03-11 16:01:07 +01:00

36 lines
862 B
JavaScript

const Factory = require('./factory.js')
const { app, BrowserWindow, ipcMain, ipcRenderer } = require('electron')
const path = require('node:path')
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
win.loadFile('index.html')
}
app.whenReady().then(() => {
ipcMain.on('task-completed', (_event, value) => {
console.log(value)
alert(value)
})
ipcMain.handle('run', (event, param) => {
Factory.get(param.workflow)
Factory.workflow.run(param.application, param.buildings, './tmp/')
})
createWindow()
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
})
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})