我有一个破坏的承诺链(蓝鸟),我无法弄清楚原因。
Promise.resolve()
.then(function() {
[..]
})
.then(function() {
[..]
})
.then(function() {
[..]
})
.spread(function(instance) {
[..]
})
这与TypeError: undefined is not a function
上的.spread
失败了。最后console.log
上的.then()
显示它返回{}
。交换spread
为then
使代码运行。我究竟做错了什么?什么会使传播未定义?
更新:将最后一个spread
更改为下面的代码使其工作。
.then(function(arr) {
var instance = arr[0];
[..]
})
我是个白痴:)错过了包括该文件中的蓝鸟,所以它使用的native implementation of promises没有spread
。