https://bugzilla.wikimedia.org/show_bug.cgi?id=30713
--- Comment #4 from [email protected] 2012-04-09 08:56:00 UTC --- Here's some fixed code. It includes a "remove" function, also, and functions return 'this' so that they can be chained (behaving the same way as jQuery Callbacks). hooks: ( function () { var callbacks = {}; function getCb( key ) { if ( callbacks[key] === undefined ) { callbacks[key] = $.Callbacks( "memory" ); } return callbacks[key]; } return { add: function (hook) { var callback = getCb(hook); callback.add.apply( callback, Array.prototype.splice.call( arguments, 1 ) ); return this; }, remove: function (hook) { var callback = getCb(hook); callback.remove.apply( callback, Array.prototype.splice.call( arguments, 1 ) ); return this; }, run: function (hook) { var callback = getCb(hook); callback.fire.apply( callback, Array.prototype.splice.call( arguments, 1 ) ); return this; } }; }() ), -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
