Created
February 23, 2010 15:32
-
-
Save kriszyp/312309 to your computer and use it in GitHub Desktop.
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 sys = require("sys"); | |
var promise = require('/home/benjamin/programming/tools/bomberjs/bundled/promise/promise'); | |
var p = new promise.Promise(); | |
var p2 = p.then( | |
function () { | |
return '1'; | |
}) | |
.then( | |
function () { | |
return '2'; | |
}); | |
promise.when(p, function(value) { | |
sys.p("Original promise fulfilled: " + value); | |
}); | |
promise.when(p2, function(value) { | |
sys.p("Returned promise fulfilled: " + value); | |
}); | |
p.resolve(0); | |
/* | |
On Node 0.1.30 for me this outputs: | |
"Returned promise fulfilled: 2" | |
"Original promise fulfilled: 0" | |
Is this different than what you see? | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment