Skip to content

Commit 46433b4

Browse files
committed
Default app
0 parents  commit 46433b4

File tree

5 files changed

+1199
-0
lines changed

5 files changed

+1199
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

appWindow.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>Text Editor</title>
5+
</head>
6+
<body>
7+
8+
</body>
9+
</html>

main.js

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
const electron = require('electron');
2+
const url = require('url');
3+
const path = require('path');
4+
5+
const {app, BrowserWindow, Menu} = electron;
6+
7+
let appWindow;
8+
9+
const appMenuTemplate = [
10+
{
11+
label: 'File',
12+
submenu: [
13+
{
14+
label: 'Open'
15+
},
16+
{
17+
label: 'Save'
18+
},
19+
{
20+
label: 'Quit',
21+
click(){
22+
app.quit();
23+
}
24+
}
25+
]
26+
}
27+
];
28+
29+
app.on('ready', () => {
30+
appWindow = new BrowserWindow({});
31+
32+
appWindow.loadURL(url.format({
33+
pathname: path.join(__dirname, 'appWindow.html'),
34+
protocol: "file:",
35+
slashes: true
36+
}))
37+
38+
const mainMenu = Menu.buildFromTemplate(appMenuTemplate);
39+
Menu.setApplicationMenu(mainMenu);
40+
41+
appWindow.on('close', () => app.quit());
42+
})

0 commit comments

Comments
 (0)