mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-03 06:58:42 +00:00
substantially improve the fire method of events, allowing unlimited event args to be passed in now.
This commit is contained in:
parent
7279755f24
commit
a9fb98c23a
1 changed files with 5 additions and 3 deletions
|
@ -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);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue