@@ -70,30 +70,30 @@ function createWindow() {
70
70
});
71
71
}
72
72
73
- // This method will be called when Electron has finished
74
- // initialization and is ready to create browser windows.
75
- // Some APIs can only be used after this event occurs.
73
+ // Electron 会在初始化后并准备
74
+ // 创建浏览器窗口时,调用这个函数。
75
+ // 部分 API 在 ready 事件触发后才能使用。
76
76
app .on (' ready' , createWindow);
77
77
78
- // Quit when all windows are closed.
78
+ // 当全部窗口关闭时退出。
79
79
app .on (' window-all-closed' , () => {
80
- // On macOS it is common for applications and their menu bar
81
- // to stay active until the user quits explicitly with Cmd + Q
80
+ // 在 macOS 上,除非用户用 Cmd + Q 确定地退出,
81
+ // 否则绝大部分应用及其菜单栏会保持激活。
82
82
if (process .platform !== ' darwin' ) {
83
83
app .quit ();
84
84
}
85
85
});
86
86
87
87
app .on (' activate' , () => {
88
- // On macOS it's common to re-create a window in the app when the
89
- // dock icon is clicked and there are no other windows open.
88
+ // 在 macOS 上,当点击 dock 图标并且该应用没有打开的窗口时,
89
+ // 绝大部分应用会重新创建一个窗口。
90
90
if (mainWindow === null ) {
91
91
createWindow ();
92
92
}
93
93
});
94
94
95
- // In this file you can include the rest of your app's specific main process
96
- // code. You can also put them in separate files and require them here.
95
+ // 在这文件,你可以续写应用剩下主进程代码。
96
+ // 也可以拆分成几个文件,然后用 require 导入。
97
97
```
98
98
最后,你想展示的 ` index.html ` :
99
99
``` html
@@ -151,11 +151,11 @@ $ ./Electron.app/Contents/MacOS/Electron your-app/
151
151
* 注意:* 运行时需要你的系统已经安装了 [ Git] [ 9 ] 和 [ Node.js] [ 10 ] (包含 [ npm] [ 11 ] )。
152
152
153
153
``` bash
154
- # Clone the repository
154
+ # 克隆这仓库
155
155
$ git clone https://github.com/electron/electron-quick-start
156
- # Go into the repository
156
+ # 进入仓库
157
157
$ cd electron-quick-start
158
- # Install dependencies and run the app
158
+ # 安装依赖库并运行应用
159
159
$ npm install && npm start
160
160
```
161
161
[ 1 ] : https://github.com/electron/electron/blob/v1.1.3/docs/api/ipc-renderer.md
0 commit comments