Skip to main content

REPL

读取-求值-打印-循环 (REPL) 是一个简单的交互式计算机编程环境,它接受单个用户输入(即单个表达式),对其进行评估,并将结果返回给用户。

¥Read-Eval-Print-Loop (REPL) is a simple, interactive computer programming environment that takes single user inputs (i.e. single expressions), evaluates them, and returns the result to the user.

主进程

¥Main process

Electron 通过 --interactive CLI 标志公开 Node.js repl 模块。假设你已将 electron 安装为本地项目依赖,你应该能够使用以下命令访问 REPL:

¥Electron exposes the Node.js repl module through the --interactive CLI flag. Assuming you have electron installed as a local project dependency, you should be able to access the REPL with the following command:

./node_modules/.bin/electron --interactive

注意:electron --interactive 在 Windows 上不可用(有关更多详细信息,请参阅 electron/electron#5776)。

¥Note: electron --interactive is not available on Windows (see electron/electron#5776 for more details).

渲染器进程

¥Renderer process

你可以使用 DevTools Console 选项卡获取任何渲染器进程的 REPL。要了解更多信息,请阅读 Chrome 文档

¥You can use the DevTools Console tab to get a REPL for any renderer process. To learn more, read the Chrome documentation.