Bug Tracker

Opened 6 years ago

Closed 6 years ago

#14593 closed feature (worksforme)

cannot merge callbacks: jQuery.Callbacks().add( jQuery.Callbacks() )

Reported by: obradovic.miroslav@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc: jaubourg
Blocked by: Blocking:

Description

jQuery.Callbacks().add() can add either a function or an array of functions, but it still does not treat another jQuery.Callbakcs() as a list of callbacks that can be added

Change History (5)

comment:1 Changed 6 years ago by timmywil

Cc: jaubourg added

Jaubourg, what do you think of this feature? I could see it being useful, but I imagine it could require more than trivial changes to the source (because the list is currently inaccessible by another jQuery.Callbacks()).

comment:2 Changed 6 years ago by anonymous

imlementing inverted logic is good enough, eg. method var c1, c2; jQuery.Callbacks() c1.addAllTo(c2)

so c1 would add its callback array to c2

comment:3 Changed 6 years ago by jaubourg

I fail to see the gain here. I'd expect c1.add( c2.fire ); to cover any use case.

comment:4 Changed 6 years ago by obradovic.miroslav@…

Good point. That was all I needed, just didn't see it so far. Can be closed as invalid. Would be useful to add an example to api.jquery.com

comment:5 Changed 6 years ago by jaubourg

Resolution: worksforme
Status: newclosed

Since there's something in the API that (sorta) does it already, let's close this as worksforme ;)

Note: See TracTickets for help on using tickets.