windows95/src/main/windows.ts
2019-08-21 19:43:21 +02:00

26 lines
509 B
TypeScript

import { BrowserWindow } from "electron";
let mainWindow: BrowserWindow | null = null;
export function getOrCreateWindow(): BrowserWindow {
if (mainWindow) return mainWindow;
// Create the browser window.
mainWindow = new BrowserWindow({
width: 1024,
height: 768,
useContentSize: true,
webPreferences: {
nodeIntegration: true
}
});
mainWindow.loadFile("./dist/static/index.html");
mainWindow.on("closed", () => {
mainWindow = null;
});
return mainWindow;
}