Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple test case for promises and §2.3.3.3
var Promise = require("promise");
var p = new Promise(function(resolve) {
// Return an object with a 'then' property
var obj = {
then: function(res, rej) {
console.log("parg === p? " + (parg === p));
console.log("this === obj? " + (this === obj));
res();
}
};
console.log("Resolving with object with 'then'");
resolve(obj);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment