๐ฅ๏ธํ๋ก ํธ์๋/Electron.js
Electron - ์ด๊ธฐ ์ค์ ๋ฐ ์คํ
Janger
2022. 3. 27. 00:57
728x90
[์ค์น]
npm init
npm i electron
[package.json]
{
"main": "main.js",
"scripts": {
"start": "electron ."
}
}
[main.js]
const { app, BrowserWindow, Menu } = require('electron');
Menu.setApplicationMenu(false); // ๋ฉ๋ด ๋นํ์ฑํ
function createWindow(){
let win = new BrowserWindow({
frame: true,
width: 600,
height: 400,
minWidth: 400,
minHeight: 200,
maxWidth: 700,
maxHeight: 500,
resizable: true,
webPreferences:{
nodeIntegration: true,
contextIsolation: false,
devTools: true
}
});
win.loadFile('./index.html');
}
app.on('ready', createWindow);
[index.html]
<html>
<head>
<title>window</title>
</head>
<body>
<h1>Hello world!</h1>
</body>
</html>
[์คํ]
npm start
728x90