Opened 6 years ago
Closed 4 years ago
#18384 closed enhancement (patchwelcome)
Add .finally() to Promises
Reported by: | MikeMacCS | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.13 |
Component: | Core | Version: | 1.10.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
It's common to want to perform some simple bookkeeping after a promise resolves, but not want to interfere with the regular flow of the promise chain. I think dojo/Promise/promise should incorporate something similar to Q's finally() method, which behaves like .always(), but resolves or rejects the resulting promise with the resolved or rejected value of the initiating promise.
See: https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback
Change History (5)
comment:1 Changed 6 years ago by
comment:2 Changed 6 years ago by
I have some simple code that accomplishes this nicely. I'm waiting on the corporate CLA to be signed before I can submit it for the next version.
comment:4 Changed 5 years ago by
Milestone: | tbd → 1.12 |
---|
comment:5 Changed 4 years ago by
Resolution: | → patchwelcome |
---|---|
Status: | new → closed |
I closed the corresponding PR because it is stale/conflicting, and agreement was unfortunately never achieved on this change. Closing as patchwelcome (which may seem a bit disingenuous, but meaning we would need a new PR and agreement on any change).
The discussion on #17211 is also relevant. If
always
is intentionally not propagating errors thenfinally
is useful when you don't want to interfere with the flow of either the callback or errback chain (and not have to worry about which path arrived atfinally
.)