You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/ npm i electron
架构
主进程和渲染器进程
运行package.json的main脚本的进程被称为 主进程,一个 Electron 应用总是有且只有一个主进程
使用了Chromium 来展示 web 页面,Chromium 的多进程架构也被使用到。每个 Electron 中的 web 页面运行在它自己的渲染进程中。
rebuild native-module
使用的包包含 C++ 的原生实现。所以在 pack 前需先用 electron-rebuild 做 rebuild。
rebuild 如果很慢,可能是要翻墙,可尝试 cnpmjs.org 提供的镜像,electron-rebuild -d=https://gh-contractor-zcbenz.cnpmjs.org/atom-shell/dist/。
GitHub - electron/electron-rebuild: Package to rebuild native Node.js modules against the currently installed Electron version
# electron-npm script
export npm_config_target=1.7.10 # Electron's version. Find with ./node_modules/.bin/electron -v
export npm_config_arch=x64 # The architecture.
export npm_config_runtime=electron # Tell node-pre-gyp we are building for Electron.
export npm_config_build_from_source=true # Tell node-pre-gyp to build module from source code.
npm install $1 # Replace with the first argument passed.
Api
demopark/electron-api-demos-Zh_CN
架构
主进程和渲染器进程
运行
package.json
的main
脚本的进程被称为 主进程,一个 Electron 应用总是有且只有一个主进程使用了Chromium 来展示 web 页面,Chromium 的多进程架构也被使用到。每个 Electron 中的 web 页面运行在它自己的渲染进程中。
rebuild native-module
使用的包包含 C++ 的原生实现。所以在 pack 前需先用 electron-rebuild 做 rebuild。
在渲染进程中使用主进程模块
使用remote api, 在主进程中导出模块, remote | Electron
另一种方式是Ipc通信
electron 中模拟终端
https://github.com/xtermjs/xterm.jsnode-pty/renderer.js at master
Microsoft/node-pty · GitHub
监听进程崩溃
renderer进程与main进程通信
使用ipc通信
Debug
使用vscode使用attach方式debug
Electron npm script
Error: Electron failed to install correctly, please delete node_modules/electron and try installing again · Issue #8466 · electron/electron
Security, Native Capabilities, and Your Responsibility | Electron
其它
Electron 应用实战 (架构篇) · Issue #13 · sorrycc/blog · GitHub
GitHub - electron-userland/electron-builder: A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box 基于
electron-packager
GitHub - electron/electron-rebuild: Package to rebuild native Node.js modules against the currently installed Electron version
The text was updated successfully, but these errors were encountered: