Migrate to ESM and fix window sizing on Windows

This commit is contained in:
Maciej Gomola 2024-10-18 19:57:13 +02:00
parent 8bc1abb990
commit ff28d089ba
2 changed files with 16 additions and 13 deletions

View File

@ -1,4 +1,17 @@
const { app, BrowserWindow } = require('electron');
import { app, BrowserWindow } from 'electron';
// A helper function for creating the window
const createWindow = () => {
const win = new BrowserWindow({
width: 290,
height: 465,
resizable: false,
autoHideMenuBar: true,
useContentSize: true,
});
win.loadFile('static/index.html');
};
app.whenReady().then(() => {
createWindow();
@ -14,14 +27,3 @@ app.whenReady().then(() => {
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});
function createWindow() {
const win = new BrowserWindow({
width: 280,
height: 485,
resizable: false,
autoHideMenuBar: true,
});
win.loadFile('static/index.html');
}

View File

@ -3,6 +3,7 @@
"version": "1.0.0",
"description": "Prosty kalkulator w Electronie",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "electron ."