Skip to content

Commit 3a01c87

Browse files
authored
Merge pull request #183 from mleguen/182-force-render-on-completion
Add force option to render and use it on complete
2 parents 4951391 + 06d8b95 commit 3a01c87

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/node-progress.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ ProgressBar.prototype.tick = function(len, tokens){
9898

9999
// progress complete
100100
if (this.curr >= this.total) {
101-
this.render();
101+
this.render(undefined, true);
102102
this.complete = true;
103103
this.terminate();
104104
this.callback(this);
@@ -114,14 +114,14 @@ ProgressBar.prototype.tick = function(len, tokens){
114114
* @api public
115115
*/
116116

117-
ProgressBar.prototype.render = function (tokens) {
117+
ProgressBar.prototype.render = function (tokens, force = false) {
118118
if (tokens) this.tokens = tokens;
119119

120120
if (!this.stream.isTTY) return;
121121

122122
var now = Date.now();
123123
var delta = now - this.lastRender;
124-
if (delta < this.renderThrottle) {
124+
if (!force && (delta < this.renderThrottle)) {
125125
return;
126126
} else {
127127
this.lastRender = now;

0 commit comments

Comments
 (0)