Ticket #8856 (closed enhancement: fixed)
Request: deferred.isUnresolved()
| Reported by: | giskard22 | Owned by: | jaubourg |
|---|---|---|---|
| Priority: | blocker | Milestone: | 1.7 |
| Component: | deferred | Version: | 1.5.2 |
| Keywords: | 1.7-discuss | Cc: | |
| Blocking: | Blocked by: |
Description (last modified by ajpiano) (diff)
Sometimes I want to see if a Deferred is still pending. I have to do:
if (def.isResolved() || def.isRejected()) ...
It would be easier to just check def.isUnresolved().
Change History
comment:1 Changed 2 years ago by timmywil
- Priority changed from undecided to low
- Component changed from unfiled to deferred
comment:3 Changed 2 years ago by timmywil
- Status changed from new to open
- Milestone changed from 1.next to 1.7
comment:6 Changed 2 years ago by john
- Keywords 1.7-discuss added
Nominating ticket for 1.7 discussion.
comment:8 Changed 2 years ago by jaubourg
+1, when a deferred is rejected then it is unresolved. Better call this isPending or something.
comment:11 Changed 2 years ago by john
- Description modified (diff)
+0, Don't have strong feelings regarding this.
comment:12 Changed 2 years ago by addyosmani
+1
comment:13 Changed 2 years ago by ajpiano
- Description modified (diff)
+1, and we should use the name isUnresolved to maintain the dichotomy
comment:14 Changed 23 months ago by dmethvin
- Priority changed from low to blocker
- Milestone changed from 1.next to 1.7
comment:15 Changed 23 months ago by jaubourg
- Owner set to jaubourg
- Status changed from open to assigned
comment:16 Changed 21 months ago by Jethro Larson
An other possibility: ! def.isResolved()
comment:17 Changed 20 months ago by jaubourg
- Status changed from assigned to closed
- Resolution set to fixed
It's called isProgressing and is in master.
Related commit: https://github.com/jquery/jquery/commit/a588336a6dcc6f29e870e8fcdd243f96bec5e833
comment:18 follow-up: ↓ 19 Changed 20 months ago by dmethvin
It may be subtle, but I think .isProgressing() has a different implication than .isUnresolved(). The former implies some sort of progress is still being made, whereas the latter just says it's not yet done.
comment:19 in reply to: ↑ 18 Changed 20 months ago by jaubourg
Replying to dmethvin:
It may be subtle, but I think .isProgressing() has a different implication than .isUnresolved(). The former implies some sort of progress is still being made, whereas the latter just says it's not yet done.
While .isProgressing() returns true, you can still notify progress (for progress callbacks). I'm just trying to be consistant with the rest of the API:
- isResolved(): .resolve() has been called
- isRejected(): .reject() has been called
- isProgressing(): progress callback can be trigerred
-ed for one-time actions, -ing for repeatable callbacks with an emphase on the callback type.
I'm strictly against isUnresolved, seeing as it is completely misleading (shouldn't it return true when the deferred is rejected?).
comment:20 Changed 13 months ago by dmethvin
Clarifying: The actual resolution in 1.7 was to add a .state to the Deferred. The .isResolved() and .isRejected() methods are deprecated and will be removed in 1.8.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
