Bug Tracker

Ticket #8256 (closed enhancement: wontfix)

Opened 4 years ago

Last modified 17 months ago

$.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 4 years ago by jaubourg

  • Status changed from new to closed
  • Resolution set to wontfix
  • Description modified (diff)

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 4 years ago by jitter

  • Priority changed from undecided to low
  • Component changed from unfiled to core

comment:3 Changed 3 years ago by rwaldron

#10307 is a duplicate of this ticket.

comment:4 Changed 3 years ago by rwaldron

  • Component changed from core to deferred

comment:5 Changed 3 years ago by rwaldron

#10367 is a duplicate of this ticket.

comment:6 Changed 3 years ago by rwaldron

#11172 is a duplicate of this ticket.

comment:7 follow-up: ↓ 8 Changed 3 years 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 3 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 3 years ago by rwaldron

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

comment:10 Changed 17 months ago by rwaldron

#14117 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.