move over to central event holder
This commit is contained in:
parent
b4cc833044
commit
5153ad6f78
|
@ -69,7 +69,7 @@ Deluge.ToolBar = {
|
|||
},
|
||||
|
||||
onToolbarRender: function(toolbar) {
|
||||
Deluge.Connections.on("connect", this.onConnect.bindWithEvent(this));
|
||||
Deluge.Events.on("connect", this.onConnect.bindWithEvent(this));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
Deluge.Connections = {
|
||||
_events: new Hash(),
|
||||
|
||||
onClose: function(e) {
|
||||
$clear(Deluge.Connections.running);
|
||||
|
@ -16,7 +15,7 @@ Deluge.Connections = {
|
|||
Deluge.Client = new JSON.RPC('/json', {
|
||||
methods: methods
|
||||
});
|
||||
Deluge.Connections.fire("connect");
|
||||
Deluge.Events.fire("connect");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -36,24 +35,6 @@ Deluge.Connections = {
|
|||
Deluge.Connections.runCheck();
|
||||
},
|
||||
|
||||
fire: function(eventName) {
|
||||
if (!this._events[eventName]) return;
|
||||
$each(this._events[eventName], function(fn) {
|
||||
fn(Deluge.Client);
|
||||
});
|
||||
},
|
||||
|
||||
on: function(eventName, fn) {
|
||||
var e = $pick(this._events[eventName], new Array());
|
||||
e.include(fn);
|
||||
this._events[eventName] = e;
|
||||
},
|
||||
|
||||
removeListener: function(eventName, fn) {
|
||||
if (!this._events[eventName]) return;
|
||||
this._events[eventName].remove(fn);
|
||||
},
|
||||
|
||||
runCheck: function() {
|
||||
Deluge.Client.web.get_hosts({
|
||||
onSuccess: Deluge.Connections.onGetHosts
|
||||
|
|
|
@ -17,7 +17,7 @@ Deluge.Ui = {
|
|||
});
|
||||
|
||||
Deluge.Login.Window.show();
|
||||
Deluge.Connections.on("connect", this.onConnect.bindWithEvent(this));
|
||||
Deluge.Events.on("connect", this.onConnect.bindWithEvent(this));
|
||||
Deluge.Client = new JSON.RPC('/json');
|
||||
|
||||
Deluge.SideBar = this.MainPanel.items.get('sidebar');
|
||||
|
|
|
@ -1,4 +1,29 @@
|
|||
var Deluge = $empty;
|
||||
var Deluge = {
|
||||
author: 'Damien Churchill <damoxc@gmail.com>',
|
||||
version: '1.2-dev'
|
||||
};
|
||||
|
||||
Deluge.Events = {
|
||||
_events: new Hash(),
|
||||
|
||||
fire: function(eventName) {
|
||||
if (!this._events[eventName]) return;
|
||||
$each(this._events[eventName], function(fn) {
|
||||
fn(Deluge.Client);
|
||||
});
|
||||
},
|
||||
|
||||
on: function(eventName, fn) {
|
||||
var e = $pick(this._events[eventName], new Array());
|
||||
e.include(fn);
|
||||
this._events[eventName] = e;
|
||||
},
|
||||
|
||||
removeListener: function(eventName, fn) {
|
||||
if (!this._events[eventName]) return;
|
||||
this._events[eventName].remove(fn);
|
||||
}
|
||||
};
|
||||
|
||||
Deluge.Formatters = {
|
||||
size: function(bytes) {
|
||||
|
|
Loading…
Reference in New Issue