0

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!

1 Answer 1

4

.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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.