pleasant-progress
Advanced tools
Comparing version 1.0.2 to 1.1.0
18
index.js
@@ -15,4 +15,20 @@ 'use strict'; | ||
PleasantProgress.prototype.forPromise = function(message, promise) { | ||
this.start(message); | ||
try { | ||
return promise.then(function(value) { | ||
this.stop(); | ||
return value; | ||
}, function(reason) { | ||
this.stop(); | ||
throw reason; | ||
}); | ||
} finally { | ||
this.stop(); | ||
} | ||
}; | ||
PleasantProgress.prototype.start = function(message, stepString) { | ||
this.message = message; | ||
this.message = message || ''; | ||
this.stepString = stepString || '.'; | ||
@@ -19,0 +35,0 @@ this.stop(); |
{ | ||
"name": "pleasant-progress", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "module for outputing a pleasant progress indicator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
2591
63