diff --git a/lib/node_modules/@stdlib/repl/presentation/examples/index.js b/lib/node_modules/@stdlib/repl/presentation/examples/index.js index f74db49e0416..555526d031a6 100644 --- a/lib/node_modules/@stdlib/repl/presentation/examples/index.js +++ b/lib/node_modules/@stdlib/repl/presentation/examples/index.js @@ -22,7 +22,11 @@ var join = require( 'path' ).join; var REPL = require( '@stdlib/repl' ); var Presentation = require( './../lib' ); // eslint-disable-line stdlib/no-redeclare +var timer; + function onExit() { + // Cancel any pending slide timeout: + clearTimeout( timer ); console.log( '' ); console.log( 'REPL closed.' ); } @@ -46,7 +50,7 @@ var len = pres.length; pres.show(); // Automate the slide show: -setTimeout( next, 2000 ); +timer = setTimeout( next, 2000 ); function next() { // If we are finished with the slide show, close the REPL... @@ -54,5 +58,5 @@ function next() { return repl.close(); } pres.next().show(); - setTimeout( next, 2000 ); + timer = setTimeout( next, 2000 ); }