-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
45 lines (37 loc) · 1.19 KB
/
main.js
File metadata and controls
45 lines (37 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const { app, BrowserWindow, ipcMain } = require('electron');
const path = require('path');
function createWindow() {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
frame: false,
webPreferences: {
contextIsolation: true, // 컨텍스트 격리 활성화
nodeIntegration: false, // Node.js 통합 비활성화
webviewTag: true, // WebView 사용을 위해 필요
preload: path.join(__dirname, 'preload.js') // preload 스크립트 지정
}
});
mainWindow.loadFile('index.html');
}
app.whenReady().then(createWindow);
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit();
});
app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
ipcMain.on('minimize', (event) => {
BrowserWindow.getFocusedWindow().minimize();
});
ipcMain.on('maximize', (event) => {
const window = BrowserWindow.getFocusedWindow();
if (window.isMaximized()) {
window.unmaximize();
} else {
window.maximize();
}
});
ipcMain.on('close', (event) => {
BrowserWindow.getFocusedWindow().close();
});