Skip to content

Instantly share code, notes, and snippets.

@CliffReimers
Last active October 5, 2021 07:20
Show Gist options
  • Save CliffReimers/cfc4784579006b79cef11c34c3a042b5 to your computer and use it in GitHub Desktop.
Save CliffReimers/cfc4784579006b79cef11c34c3a042b5 to your computer and use it in GitHub Desktop.
Window resizes when setting resizable: false
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Hello World!</title>
</head>
<body>
</body>
</html>
const {app, BrowserWindow} = require('electron')
const path = require('path')
function createWindow () {
const mainWindow = new BrowserWindow({
width: 800,
height: 600
})
mainWindow.removeMenu();
let resizable = true;
setInterval(() => {
resizable = !resizable;
mainWindow.setResizable(resizable);
console.log(mainWindow.getContentSize());
}, 2000);
}
app.whenReady().then(() => {
createWindow()
})
{
"name": "periodic-taste-snatch-95q6d",
"productName": "periodic-taste-snatch-95q6d",
"description": "My Electron application description",
"keywords": [],
"main": "./main.js",
"version": "1.0.0",
"author": "DavidReimers",
"scripts": {
"start": "electron ."
},
"dependencies": {},
"devDependencies": {
"electron": "13.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment