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
:
1 2 3 4 5 6 7 8 9 | // Extend the initial repl context. var replServer = repl.start({ options ... }); someExtension.extend(r.context); // When a new context is created extend it as well. replServer.on( 'reset' , (context) => { console.log( 'repl has a new context' ); someExtension.extend(context); }); |
Please login to continue.