Last active
August 29, 2015 14:02
-
-
Save HERRKIN/7d8170a478002945f7d3 to your computer and use it in GitHub Desktop.
This file contains 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'); | |
promise1(2).then(function (d) { | |
return promise2(d) | |
}).then(console.log,console.log) | |
function promise1 (d){ | |
var def = Q.defer(); | |
if(d===1){ | |
def.resolve('resuelto promise1') | |
}else{ | |
def.reject(new Error ('error in promise1')) | |
} | |
return def.promise | |
} | |
function promise2 ( d){ | |
var def = Q.defer(); | |
console.log(d); | |
def.reject(new Error ('error in promise2')) | |
return def.promise | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment