substantially improve the fire method of events, allowing unlimited event args to be passed in now.

This commit is contained in:
Damien Churchill 2009-02-20 22:59:56 +00:00
commit a9fb98c23a

View file

@ -6,11 +6,13 @@ var Deluge = {
Deluge.Events = { Deluge.Events = {
_events: new Hash(), _events: new Hash(),
fire: function(eventName, arg) { fire: function() {
arguments = $A(arguments);
var eventName = arguments.shift();
var eventArgs = arguments;
if (!this._events[eventName]) return; if (!this._events[eventName]) return;
$each(this._events[eventName], function(fn) { $each(this._events[eventName], function(fn) {
if ($type(fn) != 'function') return; fn.attempt(eventArgs);
fn(arg);
}); });
}, },