Created
November 24, 2013 13:44
-
-
Save arikon/7627430 to your computer and use it in GitHub Desktop.
deffered.notify() / promise.progress() test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Q = require('q'); | |
Q.thenResolve() | |
.then(function() { | |
var d = Q.defer(), | |
step = 0; | |
var interval = setInterval(function() { | |
d.notify('step ' + ++step); | |
}, 1000); | |
setTimeout(function() { | |
clearInterval(interval); | |
d.resolve(); | |
}, 10000); | |
return d.promise; | |
}) | |
.then(function() { | |
console.log('Done'); | |
}) | |
.progress(function(data) { | |
console.log('Progress:', data); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested with
[email protected]
.This will output:
So, progress messages are bubbling through the promise chain as rejection messages do.