store remote events and register them when the events are started
This commit is contained in:
parent
f831cdce9a
commit
037fbcaaa7
|
@ -41,14 +41,19 @@ Copyright:
|
|||
(function() {
|
||||
Events = Ext.extend(Ext.util.Observable, {
|
||||
constructor: function() {
|
||||
this.toRegister = [];
|
||||
Events.superclass.constructor.call(this);
|
||||
},
|
||||
|
||||
addListener: function(eventName, fn, scope, o) {
|
||||
this.addEvents(eventName);
|
||||
if (/[A-Z]/.test(eventName.substring(0, 1))) {
|
||||
if (!Deluge.Client) {
|
||||
this.toRegister.push(eventName);
|
||||
} else {
|
||||
Deluge.Client.web.register_event_listener(eventName);
|
||||
}
|
||||
}
|
||||
Events.superclass.addListener.call(this, eventName, fn, scope, o);
|
||||
},
|
||||
|
||||
|
@ -60,6 +65,9 @@ Copyright:
|
|||
},
|
||||
|
||||
start: function() {
|
||||
Ext.each(this.toRegister, function(eventName) {
|
||||
Deluge.Client.web.register_event_listener(eventName);
|
||||
});
|
||||
this.poll = this.poll.bind(this);
|
||||
this.running = setInterval(this.poll, 2000);
|
||||
this.poll();
|
||||
|
|
Loading…
Reference in New Issue