Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#8256 closed enhancement (wontfix)

$.when should accept an array of promises

Reported by: [email protected] Owned by:
Priority: low Milestone: 1.next
Component: deferred Version: 1.5
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by jaubourg)

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 (10)

comment:1 Changed 12 years ago by jaubourg

Description: modified (diff)
Resolution: wontfix
Status: newclosed

This would break things like:

$.when( [ 1, 2, 3 ] );

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.

comment:2 Changed 12 years ago by jitter

Component: unfiledcore
Priority: undecidedlow

comment:3 Changed 12 years ago by Rick Waldron

#10307 is a duplicate of this ticket.

comment:4 Changed 12 years ago by Rick Waldron

Component: coredeferred

comment:5 Changed 12 years ago by Rick Waldron

#10367 is a duplicate of this ticket.

comment:6 Changed 11 years ago by Rick Waldron

#11172 is a duplicate of this ticket.

comment:7 Changed 11 years ago by Rick Waldron

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 11 years 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.

comment:9 Changed 11 years ago by Rick Waldron

@jaubourg TBH, I'm willing to go with whatever you recommend, but I also still think it's feature creep/bloat

comment:10 Changed 10 years ago by Rick Waldron

#14117 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.