Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#15902 closed defect (wontfix)

Deferred has no always() method

Reported by: bill Owned by: Mark Wubben
Priority: undecided Milestone: tbd
Component: Core Version: 1.8.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

The doc for Promise says that it has an always() ethod, but it doesn't.

I saw this when trying to update Tree to use this.pendingCommandsDeferred.always() rather than this.pendingCommandsDeferred.then(), but the problem can be reproduced simply by:

require(["dojo/Deferred"], function(Deferred){ console.log( (new Deferred()).always ); })

Also, the API doc marks the callback parameter as optional, but presumably it's not. always() is meaningless, right?

Attachments (1)

Tree_use_always.patch (1.3 KB) - added by bill 7 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 7 years ago by bill

Owner: set to Mark Wubben
Status: newassigned

Changed 7 years ago by bill

Attachment: Tree_use_always.patch added

comment:2 Changed 7 years ago by bill

Description: modified (diff)

comment:3 Changed 7 years ago by bill

In [29577]:

Use always() not then(), so that new commands keep executing even if a previous command failed. (Note that always() method is on Promise but not on Deferred). Refs #15902 !strict.

comment:4 Changed 7 years ago by Mark Wubben

Resolution: wontfix
Status: assignedclosed

Utility methods are on promises, not on the deferreds. You could use this.pendingCommandsDeferred.promise.always().

The callback is optional so far as that no errors are thrown if it's missing, but obviously it'd mean the resulting promise won't be resolved with any value.

comment:5 Changed 7 years ago by bill

Surely the callback is mandatory. What exactly would always() with no argument do?

comment:6 Changed 7 years ago by Mark Wubben

Following <https://github.com/dojo/dojo/blob/master/Deferred.js#L32>, it's effectively a noop that just creates a new promise. Like calling deferred.then().

Note: See TracTickets for help on using tickets.