-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Closed
Description
Obviously, .then() is listed as the official replacement for .pipe(), however as described in #3325, .then() forces execution of the callback onto a new context, even in the case of a promise/deferred that is already resolved, unlike .pipe().
In the following case, .then() is not a suitable replacement for .pipe(), for the above reason.
var promise = someAsyncOperation()
.then(function(results)) {
return processResults(results);
});
if (promise.state() !== "resolved") {
$overlay.fadeIn(500);
promise
.done(function() {
$overlay.fadeOut(500);
});
}
return promise;If someAsyncOperation() utilizes .then() to filter results anywhere in the call chain, the $overlay animations will play unintentionally.
As far as I can tell, there's no alternative in the current library to combine the "immediate callback" behavior of .done() with the filtering behavior of .then(), except for the deprecated method .pipe(). Am I missing something?
Metadata
Metadata
Assignees
Labels
No labels