跳转到主内容

交互式解释器 (REPL)

读取(Read)-运算(Eval)-输出(Print)-循环(Loop) (REPL) 是一个简单的, 交互式的计算机编程环境,它采用单个用户输入(即单个表达式),运算并返回结果给用户。

主进程

Electron 通过 --interactive 命令行参数将 Node.js repl 模块暴露出去。 假设你已将 electron 安装为本地项目依赖,则应能够使用下面的命令访问 REPL:

./node_modules/.bin/electron --interactive
info

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

渲染器进程

你可以使用开发者工具Console选项卡获取任意渲染器进程的REPL。 To learn more, read the Chrome documentation.