mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
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:
Vendored
+6
-3
@@ -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)
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
Reference in New Issue
Block a user