windows95/src/main/windows.ts

28 lines
558 B
TypeScript
Raw Normal View History

2019-08-21 09:48:49 +02:00
import { BrowserWindow } from "electron";
2019-08-21 19:43:21 +02:00
let mainWindow: BrowserWindow | null = null;
export function getOrCreateWindow(): BrowserWindow {
if (mainWindow) return mainWindow;
2019-08-21 09:48:49 +02:00
// Create the browser window.
mainWindow = new BrowserWindow({
width: 1024,
height: 768,
useContentSize: true,
webPreferences: {
2019-08-24 16:58:21 +02:00
nodeIntegration: true,
sandbox: false,
2020-08-02 22:11:20 +02:00
webviewTag: false,
},
2019-08-21 09:48:49 +02:00
});
mainWindow.loadFile("./dist/static/index.html");
mainWindow.on("closed", () => {
mainWindow = null;
});
2019-08-21 19:43:21 +02:00
return mainWindow;
2019-08-21 09:48:49 +02:00
}