Merge pull request #22237 from s73obrien/progress-changes

Added missing interrupt function signature to ProgressBar class in typings for progress package
This commit is contained in:
Arthur Ozga
2017-12-19 15:56:00 -08:00
committed by GitHub
2 changed files with 19 additions and 3 deletions
+6 -3
View File
@@ -120,14 +120,17 @@ declare class ProgressBar {
* overall completion to.
*/
update(ratio: number, tokens?: any): void;
/**
* "interrupt" the progress bar and write a message above it.
*/
interrupt(message: string): void;
/**
* Terminates a progress bar.
*/
*/
terminate(): void;
/**
* Completed status of progress (Boolean)
*/
+13
View File
@@ -27,3 +27,16 @@ bar.tick(2, {
'token1': "Goodbye",
'token2': "World!"
});
/**
* Interrupt example from https://github.com/visionmedia/node-progress
*/
var bar = new ProgressBar(':bar :current/:total', { total: 10 });
var timer = setInterval(function () {
bar.tick();
if (bar.complete) {
clearInterval(timer);
} else if (bar.curr === 5) {
bar.interrupt('this message appears above the progress bar\ncurrent progress is ' + bar.curr + '/' + bar.total);
}
}, 1000);