added ipc code to main electron js file

This commit is contained in:
trippjoe 2022-03-27 20:43:26 -04:00
parent 0421c32c0c
commit 13386f2e59
3 changed files with 1415 additions and 159 deletions

1554
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -44,7 +44,9 @@
}
},
"dependencies": {
"async": "^3.2.3",
"bootstrap": "^5.1.3",
"download-git-repo": "^3.0.2",
"electron-squirrel-startup": "^1.0.0"
},
"devDependencies": {

View file

@ -1,6 +1,7 @@
const { app, BrowserWindow } = require('electron');
const { app, BrowserWindow, ipcMain } = require('electron');
const path = require('path');
const isDev = !app.isPackaged;
const { launchGame, buildGame, isoSeries, fetchLatestCommit } = require('./js/utils/utils.js');
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require('electron-squirrel-startup')) {
@ -57,3 +58,18 @@ app.on('activate', () => {
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and import them here.
// IPC STUFF HERE
ipcMain.on('getISO', isoSeries);
ipcMain.handle('checkUpdates', async () => {
let response = await fetchLatestCommit();
return response;
});
ipcMain.on('build', buildGame);
ipcMain.on('launch', launchGame);
app.on('status', (status) => {
win.webContents.send('status', status);
});