Skip to content

Instantly share code, notes, and snippets.

@kriszyp
Created February 23, 2010 15:32
Show Gist options
  • Save kriszyp/312309 to your computer and use it in GitHub Desktop.
Save kriszyp/312309 to your computer and use it in GitHub Desktop.
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