Permalink
Browse files

document REPLServer's new 'reset' event

  • Loading branch information...
1 parent c0d484f commit 489b711432864f9e271533d9e6971e3f4c265e62 @samsonjs committed Mar 14, 2013
Showing with 21 additions and 0 deletions.
  1. +21 −0 doc/api/repl.markdown
View
@@ -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 -->

0 comments on commit 489b711

Please sign in to comment.