Skip to main content

交互式编程环境

🌐 REPL

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

主进程

🌐 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
note

electron --interactive 在 Windows 上不可用 (详情请参见 electron/electron#5776)。

渲染器进程

🌐 Renderer process

你可以使用 DevTools 的控制台标签来获取任何渲染进程的 REPL。要了解更多信息,请阅读 Chrome 文档

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