docs: document the repl "exit" event

pull/24503/head
Nathan Rajlich 2012-03-13 11:50:28 -07:00 committed by Bert Belder
parent f9da776b33
commit 884a209ccf
1 changed files with 16 additions and 2 deletions

View File

@ -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