Bug Tracker

Opened 12 years ago

Closed 12 years ago

#9016 closed enhancement (wontfix)

.then() should return a new promise

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


other promise implementations return a new promise from .then(). that way, you can pass values down the chain. eg see: https://github.com/sifu/jquery-deferred/blob/master/jquery.deferred.js#L241

Change History (2)

comment:1 Changed 12 years ago by ajpiano

Component: unfileddeferred
Type: bugenhancement

I believe we have accomplished this functionality in jQuery 1.6 with Deferred.pipe(), which has already landed.

comment:2 Changed 12 years ago by jaubourg

Resolution: wontfix
Status: newclosed

Yes, pipe is what you need.

I know we broke the Promises/A contract not implementing this behaviour on then() but the general use case is to bind callbacks and having then() create a new Deferred everytime under the hood was a bit heavy-weight to say the least. We preferred to make it explicit: if you wanna chain, use pipe() (as in shell pipe -- get original Deferred output in, return a value or a new Observable out).

I talked with Kris Zyp about this and he seemed quite happy with the way jQuery implemented Promises and was not at all bothered by this deviation.

Note: See TracTickets for help on using tickets.