开发者

Problem with Deferreds -- Adding Custom Deferred Object to Array

开发者 https://www.devze.com 2023-04-01 17:17 出处:网络
I am trying to learn how to create custom Deferred objects and am working on the following: http://jsfiddle.net/jhYjw/7/

I am trying to learn how to create custom Deferred objects and am working on the following:

http://jsfiddle.net/jhYjw/7/

Something must be up with jsFiddle, but when I run that code on my local browser, everything seems to work.

The deferreds are all called then the .done() is 开发者_如何学运维called.

However, there are no arguments passed in to the .done(). It's [] "result" in undefined.

What's going on? :P I'm passing in a string to resolveWith()

Thanks SO!


.resolveWith(x)[docs] doesn't pass x to your callbacks. It runs your callbacks with this set to x.

To pass x as the argument of your callback function use .resolve(x)[docs], or .resolveWith(valueForThis, x).

0

精彩评论

暂无评论...
验证码 换一张
取 消