Skip to main content

Bug Tracker

Side navigation

#9016 closed enhancement (wontfix)

Opened April 29, 2011 01:08PM UTC

Closed April 29, 2011 01:55PM UTC

.then() should return a new promise

Reported by: sifu@0xx0.net Owned by:
Priority: undecided Milestone: 1.next
Component: deferred Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:
Description

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

Attachments (0)
Change History (2)

Changed April 29, 2011 01:40PM UTC by ajpiano comment:1

component: unfileddeferred
type: bugenhancement

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

Changed April 29, 2011 01:55PM UTC by jaubourg comment:2

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.