diff options
author | Nathan Rajlich <nathan@tootallnate.net> | 2012-03-13 22:50:28 +0400 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2012-03-13 22:58:54 +0400 |
commit | 884a209ccfd5bac74d891cdea50750cb6cd842a1 (patch) | |
tree | 335900592fd9a6dd396229076ed0c47dff165f24 /doc | |
parent | f9da776b332fbb1b7443da3446de9127b98b3d94 (diff) |
docs: document the repl "exit" event
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/repl.markdown | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/doc/api/repl.markdown b/doc/api/repl.markdown index a5fd1acacb9..60a5b72ab77 100644 --- a/doc/api/repl.markdown +++ b/doc/api/repl.markdown @@ -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 |