Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-12-13 01:08:16 +0300
committerRuben Bridgewater <ruben@bridgewater.de>2020-01-03 18:43:43 +0300
commit84b15ebf2430a0a85e937ba5687c368b4f18091d (patch)
tree3bca2db4b686e6e0cd8a275959eccdc5df5509d5 /doc/api/repl.md
parent84c426cb60751b85be817d44a21646393762edc6 (diff)
doc: update REPL documentation to instantiate the REPL
The documentation currently states that it's not intended to directly instantiate REPL instances. It is unknown for what reason that's recommended as it does seem a proper way to handle new REPL instances. PR-URL: https://github.com/nodejs/node/pull/30928 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc/api/repl.md')
-rw-r--r--doc/api/repl.md15
1 files changed, 13 insertions, 2 deletions
diff --git a/doc/api/repl.md b/doc/api/repl.md
index 37ca988cb80..602aea02ab5 100644
--- a/doc/api/repl.md
+++ b/doc/api/repl.md
@@ -352,10 +352,20 @@ function myWriter(output) {
added: v0.1.91
-->
+* `options` {Object|string} See [`repl.start()`][]
* Extends: {readline.Interface}
-Instances of `repl.REPLServer` are created using the `repl.start()` method and
-*should not* be created directly using the JavaScript `new` keyword.
+Instances of `repl.REPLServer` are created using the [`repl.start()`][] method
+or directly using the JavaScript `new` keyword.
+
+```js
+const repl = require('repl');
+
+const options = { useColors: true };
+
+const firstInstance = repl.start(options);
+const secondInstance = new repl.REPLServer(options);
+```
### Event: `'exit'`
<!-- YAML
@@ -724,6 +734,7 @@ For an example of running a REPL instance over [curl(1)][], see:
[`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn
[`readline.InterfaceCompleter`]: readline.html#readline_use_of_the_completer_function
[`repl.ReplServer`]: #repl_class_replserver
+[`repl.start()`]: #repl_repl_start_options
[`util.inspect()`]: util.html#util_util_inspect_object_options
[curl(1)]: https://curl.haxx.se/docs/manpage.html
[stream]: stream.html