Ticket #8256 (closed enhancement: wontfix)
$.when should accept an array of promises
| Reported by: | me@… | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | deferred | Version: | 1.5 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description (last modified by jaubourg) (diff)
This would be super nice, because $.when.apply($, promisesArr) looks converugly.
I'm not sure if there's a case where you'd want an array to be treated like a resolved Deferred that this would break – if so, maybe you could peek at the first element to see if it's a promise?
Change History
comment:1 Changed 2 years ago by jaubourg
- Status changed from new to closed
- Resolution set to wontfix
- Description modified (diff)
comment:2 Changed 2 years ago by jitter
- Priority changed from undecided to low
- Component changed from unfiled to core
comment:7 follow-up: ↓ 8 Changed 16 months ago by rwaldron
So, considering the number of requests for this feature, I'm wondering if we should consider adding support?
comment:8 in reply to: ↑ 7 Changed 16 months ago by jaubourg
Replying to rwaldron:
So, considering the number of requests for this feature, I'm wondering if we should consider adding support?
If we do so, then we add the two liner given above. I think people are being lazy here and refuse to aknowledge the inconsistencies implied as long as "it works" for them.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

This would break things like:
Inspecting the first element only wouldn't make sense either.
You can easily code your own whenArray functionality if and when you're tired of apply:
jQuery.whenArray = function( array ) { return jQuery.when.apply( this, array ); };A "deep" when could be nice though but that's another conversation.