trying stuff with electron forge but moving away

This commit is contained in:
talksik
2022-03-15 13:21:45 -04:00
parent 381eb9ce2f
commit ef72bc3158
14 changed files with 194 additions and 22 deletions
+9 -6
View File
@@ -1,11 +1,11 @@
import { app, BrowserWindow } from 'electron';
import { BrowserWindow, app } from "electron";
// This allows TypeScript to pick up the magic constant that's auto-generated by Forge's Webpack
// plugin that tells the Electron app where to look for the Webpack-bundled app code (depending on
// whether you're running in development or production).
declare const MAIN_WINDOW_WEBPACK_ENTRY: string;
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require('electron-squirrel-startup')) {
if (require("electron-squirrel-startup")) {
// eslint-disable-line global-require
app.quit();
}
@@ -15,6 +15,9 @@ const createWindow = (): void => {
const mainWindow = new BrowserWindow({
height: 600,
width: 800,
webPreferences: {
preload: MAIN_WINDOW_WEBPACK_ENTRY,
}, // use a preload script
});
// and load the index.html of the app.
@@ -27,18 +30,18 @@ const createWindow = (): void => {
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow);
app.on("ready", createWindow);
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});
app.on('activate', () => {
app.on("activate", () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) {