Skip to main content

Bug Tracker

Side navigation

#8856 closed enhancement (fixed)

Opened April 12, 2011 11:11PM UTC

Closed September 22, 2011 02:49PM UTC

Last modified May 08, 2012 08:31PM UTC

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

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().

Attachments (0)
Change History (20)

Changed April 15, 2011 05:00AM UTC by timmywil comment:1

component: unfileddeferred
priority: undecidedlow

Changed April 16, 2011 09:46PM UTC by john comment:2

Let's consider this for 1.7.

Changed April 17, 2011 07:36AM UTC by timmywil comment:3

milestone: 1.next1.7
status: newopen

Changed April 17, 2011 11:35PM UTC by jaubourg comment:4

I'd vote for isPending()

Changed April 17, 2011 11:42PM UTC by john comment:5

milestone: 1.71.next

Changed May 22, 2011 07:27PM UTC by john comment:6

keywords: → 1.7-discuss

Nominating ticket for 1.7 discussion.

Changed May 22, 2011 09:28PM UTC by rwaldron comment:7

description: 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().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().

+1,

Changed May 23, 2011 12:38AM UTC by jaubourg comment:8

+1, when a deferred is rejected then it is unresolved. Better call this isPending or something.

Changed May 23, 2011 04:28AM UTC by timmywil comment:9

+1,

Changed May 24, 2011 09:29PM UTC by dmethvin comment:10

description: 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().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().

+1, Definitely.

Changed June 03, 2011 01:53PM UTC by john comment:11

description: 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().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().

+0, Don't have strong feelings regarding this.

Changed June 04, 2011 10:18PM UTC by addyosmani comment:12

+1

Changed June 05, 2011 09:29PM UTC by ajpiano comment:13

description: 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().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().

+1, and we should use the name isUnresolved to maintain the dichotomy

Changed July 12, 2011 03:03PM UTC by dmethvin comment:14

milestone: 1.next1.7
priority: lowblocker

Changed July 12, 2011 03:38PM UTC by jaubourg comment:15

owner: → jaubourg
status: openassigned

Changed September 09, 2011 09:49PM UTC by Jethro Larson comment:16

An other possibility: ! def.isResolved()

Changed September 22, 2011 02:49PM UTC by jaubourg comment:17

resolution: → fixed
status: assignedclosed

It's called isProgressing and is in master.

Related commit: https://github.com/jquery/jquery/commit/a588336a6dcc6f29e870e8fcdd243f96bec5e833

Changed September 22, 2011 10:41PM UTC by dmethvin comment:18

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.

Changed September 23, 2011 06:53AM UTC by jaubourg comment:19

Replying to [comment:18 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?).

Changed May 08, 2012 08:31PM UTC by dmethvin comment:20

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.