Electron Basic Template
This commit is contained in:
11
app.js
11
app.js
@@ -1,11 +0,0 @@
|
||||
function closeWindow() {
|
||||
window.close();
|
||||
}
|
||||
|
||||
document.getElementById("close").addEventListener("click", closeWindow);
|
||||
|
||||
function minimizeWindow() {
|
||||
remote.getCurrentWindow().minimize();
|
||||
}
|
||||
// werkt niet!!!
|
||||
document.getElementById("minimize").addEventListener("click", minimizeWindow);
|
||||
2
index.py
2
index.py
@@ -47,7 +47,7 @@ def fetch_data():
|
||||
|
||||
try:
|
||||
response = requests.get(url, headers=headers)
|
||||
response.raise_for_status() # Raise an exception for 4xx and 5xx status codes
|
||||
response.raise_for_status()
|
||||
|
||||
data = response.json()
|
||||
load_data(data)
|
||||
|
||||
51
main.js
51
main.js
@@ -1,46 +1,39 @@
|
||||
const { app, BrowserWindow, nativeImage, shell } = require("electron");
|
||||
const screen = require("electron").screen;
|
||||
// const screen = require("electron").screen;
|
||||
const path = require("path");
|
||||
|
||||
let mainWindow;
|
||||
|
||||
function createWindow() {
|
||||
const iconPath = path.join(__dirname, "images/logo.png");
|
||||
const icon = nativeImage.createFromPath(iconPath);
|
||||
function createWindow()
|
||||
{
|
||||
// const iconPath = path.join(__dirname, "images/logo.png");
|
||||
// const icon = nativeImage.createFromPath(iconPath);
|
||||
const urlElectron = path.join(__dirname, "src/main.html");
|
||||
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 450,
|
||||
height: 500, //moet 500 zijn als frame false is
|
||||
webPreferences: {
|
||||
mainWindow = new BrowserWindow(
|
||||
{
|
||||
width: 1000,
|
||||
height: 650,
|
||||
webPreferences:
|
||||
{
|
||||
nodeIntegration: true,
|
||||
},
|
||||
resizable: false,
|
||||
frame: false,
|
||||
icon: icon,
|
||||
frame: true,
|
||||
// icon: icon,
|
||||
alwaysOnTop: true,
|
||||
backgroundColor: "red"
|
||||
// backgroundColor: "green"
|
||||
});
|
||||
|
||||
const { width, height } = screen.getPrimaryDisplay().workAreaSize;
|
||||
mainWindow.setPosition(width - 450, height - 500);
|
||||
// const { width, height } = screen.getPrimaryDisplay().workAreaSize;
|
||||
// mainWindow.setPosition(width - 450, height - 500);
|
||||
|
||||
mainWindow.loadURL("C:/Users/oomen/OneDrive - mboRijnland/Schooljaar 23-24/P3/ALA/GoodGarden/index.html");
|
||||
mainWindow.loadURL(urlElectron);
|
||||
|
||||
mainWindow.on("closed", function () {
|
||||
mainWindow = null;
|
||||
});
|
||||
// mainWindow.on("closed", function ()
|
||||
// {
|
||||
// mainWindow = null;
|
||||
// });
|
||||
}
|
||||
|
||||
app.on("ready", createWindow);
|
||||
|
||||
app.on("window-all-closed", function () {
|
||||
if (process.platform !== "darwin") {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
||||
app.on("activate", function () {
|
||||
if (mainWindow === null) {
|
||||
createWindow();
|
||||
}
|
||||
});
|
||||
|
||||
265
package-lock.json
generated
265
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "app",
|
||||
"name": "goodgarden",
|
||||
"description": "",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
@@ -9,6 +9,9 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"electron": "^23.1.1"
|
||||
"electron": "^23.3.13"
|
||||
},
|
||||
"dependencies": {
|
||||
"elctron": "^0.0.1-security"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>HALLO WERELD!!!!!</h1>
|
||||
<h1>sdgdfsgjindgfvadsiuuiadsiuhdgnhaewgiadsnugaeuigndfogjdfsgdff</h1>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user