Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
docs: document the repl "exit" event
Browse files Browse the repository at this point in the history
  • Loading branch information
TooTallNate authored and piscisaureus committed Mar 13, 2012
1 parent f9da776 commit 884a209
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions doc/api/repl.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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()`.

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 884a209

Please sign in to comment.