Migrate to ESM and fix window sizing on Windows
This commit is contained in:
parent
8bc1abb990
commit
ff28d089ba
28
index.js
28
index.js
@ -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();
|
||||
@ -13,15 +26,4 @@ app.whenReady().then(() => {
|
||||
// If all windows are closed and we're not running macOS, quit the app.
|
||||
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');
|
||||
}
|
||||
});
|
@ -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 ."
|
||||
|
Loading…
Reference in New Issue
Block a user