Author: damoxc

Revision: 5760

Log:
        store remote events and register them when the events are started

Diff:
Modified: trunk/deluge/ui/web/js/Deluge.Events.js
===================================================================
--- trunk/deluge/ui/web/js/Deluge.Events.js     2009-09-16 09:38:46 UTC (rev 
5759)
+++ trunk/deluge/ui/web/js/Deluge.Events.js     2009-09-16 09:39:30 UTC (rev 
5760)
@@ -41,13 +41,18 @@
 (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))) {
-               Deluge.Client.web.register_event_listener(eventName);
+               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 @@
        },
        
        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();



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to