Skip to content

Commit 98810a8

Browse files
author
wangb
committed
add electron api
1 parent b0a15f5 commit 98810a8

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

source/_drafts/electron-api.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: electron-api
3+
tags:
4+
---
5+
6+
## Process
7+
1. Main Process and Render Proccess (`BrowserWindow` module)
8+
2. Main process is responsible for creating and managing `BrowserWindow` and application events.
9+
2. In The Render Process we can get `BrowserWindow` module and other electron module by `electron.remote`
10+
3. `ipcMain, ipcRender` module allows you to send and receive synchronous(`sendSync`) and asynchronous(`send`) messages between the main and render processes.
11+
12+
## Window
13+
3. There is a option(`{show: false}`) for `BrowserWindow` can hide the window, which can be used for background task.
14+
4. we use `BrowserWindow.loadURL` to load html for our works.
15+
4. We can listen various events on window like `focus, blur, close` etc. There are also `unresponsive, responsive` event on `BrowserWindow` and `crashed` event on `BrowserWindow.webContents`
16+
5. window can be frameless, without toolbars, title bars, status bars, borders (`{frame: false}`).
17+
6. WebContents: we can send event to window
18+
19+
## Menu
20+
- Two kinds of menus: application menu, context menu
21+
- Two modules: `electron.Menu, electron.MenuItem` (alse in remote)
22+
23+
## Native User Interface
24+
- `shell`: open external links and the file manager
25+
- `dialog`: system dialogs
26+
- `Tray`
27+
28+
## System
83.1 KB
Loading

0 commit comments

Comments
 (0)