docs: update REPL guide (#28943)

* docs: update REPL guide

* Update docs/tutorial/repl.md

Co-authored-by: Mark Lee <malept@users.noreply.github.com>

Co-authored-by: Mark Lee <malept@users.noreply.github.com>
This commit is contained in:
Erick Zhao 2021-05-04 01:17:04 -07:00 committed by GitHub
parent 005101424a
commit 41bb3f1321
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 16 deletions

View file

@ -68,6 +68,7 @@ an issue:
* [Testing on Headless CI Systems (Travis, Jenkins)](tutorial/testing-on-headless-ci.md) * [Testing on Headless CI Systems (Travis, Jenkins)](tutorial/testing-on-headless-ci.md)
* [DevTools Extension](tutorial/devtools-extension.md) * [DevTools Extension](tutorial/devtools-extension.md)
* [Automated Testing with a Custom Driver](tutorial/automated-testing-with-a-custom-driver.md) * [Automated Testing with a Custom Driver](tutorial/automated-testing-with-a-custom-driver.md)
* [REPL](tutorial/repl.md)
* [Distribution](tutorial/application-distribution.md) * [Distribution](tutorial/application-distribution.md)
* [Supported Platforms](tutorial/support.md#supported-platforms) * [Supported Platforms](tutorial/support.md#supported-platforms)
* [Code Signing](tutorial/code-signing.md) * [Code Signing](tutorial/code-signing.md)

View file

@ -1,27 +1,23 @@
# REPL # REPL
Read-Eval-Print-Loop (REPL) is a simple, interactive computer programming [Read-Eval-Print-Loop](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) (REPL)
environment that takes single user inputs (i.e. single expressions), evaluates is a simple, interactive computer programming environment that takes single user
them, and returns the result to the user. inputs (i.e. single expressions), evaluates them, and returns the result to the user.
The `repl` module provides a REPL implementation that can be accessed using: ## Main process
* Assuming you have `electron` or `electron-prebuilt` installed as a local Electron exposes the [Node.js `repl` module](https://nodejs.org/dist/latest/docs/api/repl.html)
project dependency: 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:
```sh ```sh
./node_modules/.bin/electron --interactive ./node_modules/.bin/electron --interactive
``` ```
* Assuming you have `electron` or `electron-prebuilt` installed globally: **Note:** `electron --interactive` is not available on Windows
(see [electron/electron#5776](https://github.com/electron/electron/pull/5776) for more details).
```sh ## Renderer process
electron --interactive
```
This only creates a REPL for the main process. You can use the Console You can use the DevTools Console tab to get a REPL for any renderer process.
tab of the Dev Tools to get a REPL for the renderer processes. To learn more, read [the Chrome documentation](https://developer.chrome.com/docs/devtools/console/).
**Note:** `electron --interactive` is not available on Windows.
More information can be found in the [Node.js REPL docs](https://nodejs.org/dist/latest/docs/api/repl.html).