Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/node_modules/@stdlib/repl/presentation/examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.' );
}
Expand All @@ -46,13 +50,13 @@ 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...
if ( pres.currentSlide === len ) {
return repl.close();
}
pres.next().show();
setTimeout( next, 2000 );
timer = setTimeout( next, 2000 );
}
Loading