Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

document REPLServer's new 'reset' event

  • Loading branch information...
commit 489b711432864f9e271533d9e6971e3f4c265e62 1 parent c0d484f
@samsonjs authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 doc/api/repl.markdown
View
21 doc/api/repl.markdown
@@ -135,6 +135,27 @@ Example of listening for `exit`:
});
+### Event: 'reset'
+
+`function (context) {}`
+
+Emitted when the REPL's context is reset. This happens when you type `.clear`.
+If you start the repl with `{ useGlobal: true }` then this event will never
+be emitted.
+
+Example of listening for `reset`:
+
+ // Extend the initial repl context.
+ r = repl.start({ options ... });
+ someExtension.extend(r.context);
+
+ // When a new context is created extend it as well.
+ r.on('reset', function (context) {
+ console.log('repl has a new context');
+ someExtension.extend(context);
+ });
+
+
## REPL Features
<!-- type=misc -->
Please sign in to comment.
Something went wrong with that request. Please try again.