mirror of https://github.com/nodejs/node.git
docs: document the repl "exit" event
parent
f9da776b33
commit
884a209ccf
|
@ -29,8 +29,8 @@ For example, you could add this to your bashrc file:
|
|||
|
||||
## repl.start([prompt], [stream], [eval], [useGlobal], [ignoreUndefined])
|
||||
|
||||
Starts a REPL with `prompt` as the prompt and `stream` for all I/O. `prompt`
|
||||
is optional and defaults to `> `. `stream` is optional and defaults to
|
||||
Returns and starts a REPL with `prompt` as the prompt and `stream` for all I/O.
|
||||
`prompt` is optional and defaults to `> `. `stream` is optional and defaults to
|
||||
`process.stdin`. `eval` is optional too and defaults to async wrapper for
|
||||
`eval()`.
|
||||
|
||||
|
@ -76,6 +76,20 @@ TCP sockets.
|
|||
By starting a REPL from a Unix socket-based server instead of stdin, you can
|
||||
connect to a long-running node process without restarting it.
|
||||
|
||||
### Event: 'exit'
|
||||
|
||||
`function () {}`
|
||||
|
||||
Emitted when the user exits the REPL in any of the defined ways. Namely, typing
|
||||
`.exit` at the repl, or pressing Ctrl+C twice to signal SIGINT.
|
||||
|
||||
Example of listening for `exit`:
|
||||
|
||||
r.on('exit', function () {
|
||||
console.log('Got "exit" event from repl!');
|
||||
process.exit();
|
||||
});
|
||||
|
||||
|
||||
## REPL Features
|
||||
|
||||
|
|
Loading…
Reference in New Issue