From 6a248a873af215c874c294bb7468e688bb5af17e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=89=E9=9E=8B=E6=B2=A1=E5=8F=B7?= <308487730@qq.com> Date: Sat, 18 Dec 2021 09:44:36 +0800 Subject: [PATCH] chore(docs): use Electron, NodeJs API in Renderer-process --- README.md | 6 ++++-- README.zh-CN.md | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3cea650..19cf2e4 100644 --- a/README.md +++ b/README.md @@ -65,9 +65,11 @@ ├ ``` -## Communication +## Use Electron, NodeJs API -**All NodeJs、Electron API invoke passed `Preload-script`** +> 🚨 By default, Electron don't support the use of API related to Electron and NoeJs in the Renderer-process, but someone still need to use it. If so, you can see the 👉 npm-package **[vitejs-plugin-electron](https://www.npmjs.com/package/vitejs-plugin-electron)** or another template **[vite-webpack-electron](https://github.com/caoxiemeihao/vite-webpack-electron)** + +#### All Electron, NodeJs API invoke passed `Preload-script` * **src/preload/index.ts** diff --git a/README.zh-CN.md b/README.zh-CN.md index 8d427b7..5279189 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -68,9 +68,8 @@ ## 渲染进程使用 NodeJs API -- 因为安全的原因 Electron 默认不支持在 渲染进程 中使用 NodeJs API +> 🚨 因为安全的原因 Electron 默认不支持在 渲染进程 中使用 NodeJs API,但是有些小沙雕就是想这么干,拦都拦不住;实在想那么干的话,这里有个 👉 npm 包 **[vitejs-plugin-electron](https://www.npmjs.com/package/vitejs-plugin-electron)** 或者使用另一个模板 **[vite-webpack-electron](https://github.com/caoxiemeihao/vite-webpack-electron)** - (如果你执意要在 渲染进程 中使用 NodeJs API 那请自便) - 推荐所有的 NodeJs、Electron API 通过 `preload-script` 注入到 渲染进程中,例如: