#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: | |
Blocked by: | Blocking: |
Description (last modified by )
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 (20)
comment:1 Changed 12 years ago by
Component: | unfiled → deferred |
---|---|
Priority: | undecided → low |
comment:2 Changed 12 years ago by
comment:3 Changed 12 years ago by
Milestone: | 1.next → 1.7 |
---|---|
Status: | new → open |
comment:5 Changed 12 years ago by
Milestone: | 1.7 → 1.next |
---|
comment:8 Changed 12 years ago by
+1, when a deferred is rejected then it is unresolved. Better call this isPending or something.
comment:11 Changed 12 years ago by
Description: | modified (diff) |
---|
+0, Don't have strong feelings regarding this.
comment:13 Changed 12 years ago by
Description: | modified (diff) |
---|
+1, and we should use the name isUnresolved to maintain the dichotomy
comment:14 Changed 12 years ago by
Milestone: | 1.next → 1.7 |
---|---|
Priority: | low → blocker |
comment:15 Changed 12 years ago by
Owner: | set to jaubourg |
---|---|
Status: | open → assigned |
comment:17 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
It's called isProgressing and is in master.
Related commit: https://github.com/jquery/jquery/commit/a588336a6dcc6f29e870e8fcdd243f96bec5e833
comment:18 follow-up: 19 Changed 12 years ago by
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 Changed 12 years ago by
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 11 years ago by
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.
Let's consider this for 1.7.