Bug Tracker

Opened 8 years ago

Closed 8 years ago

#13927 closed feature (wontfix)

New Callbacks.promise() method

Reported by: DzenisevichK Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

Description

Why don't add promise method to Callbacks as in Deferred? This method should return copy of a callback but without fire and fireWith...

Change History (1)

comment:1 Changed 8 years ago by jaubourg

Resolution: wontfix
Status: newclosed

The notion of a "promise" when it come to a Callbacks object doesn't make a lot of sense. Callbacks are low-level objects that already provide a lot and we don't intend to complexify their API even more.

Keep in mind Callbacks methods are "detachable", exactly like Deferreds methods btw. So you could create a new object with the methods you want :

function cbReadOnly( callbacks ) {
  return {
    add: callbacks.add,
    remove: callbacks.remove
  };
}
Note: See TracTickets for help on using tickets.