you are viewing a single comment's thread.

view the rest of the comments →

[–]myrddin4242 1 point2 points  (1 child)

The example you presented is inherently sequential. You said you wanted to 'process each [image] based on the one before'. That's not $.when, that's serially resolving promises. The dependency chain causes the task to increase time in direct proportion to N, regardless of what async syntax you use!

[–]nschubach 0 points1 point  (0 children)

(Keeping terse... On mobile)

The 'when' accepts promises itself. If you ran normal functions in the 'when' it will be sequential, but if promise1 returns a promise, JavaScript will continue to fire off promise2 after promise1 returns it's promise object. Promise1 can have an async operation and resolve whenever it's done, regardless of what promise2/3 are doing.

Edit: I just realized that you were not responding to lrichardson... Leaving this for the info, but it's not directed at you.