Script components returning data form proxied functions
authorDarren <darren@Darrens-MacBook-Pro.local>
Sun, 10 Mar 2013 15:58:50 +0000 (15:58 +0000)
committerDarren <darren@Darrens-MacBook-Pro.local>
Sun, 10 Mar 2013 15:58:50 +0000 (15:58 +0000)
client/assets/dev/app.js

index ee1ff68b85ac82be4ea6ec9f9012f2f35561a514..9187b5bd870c748cdd9a9ca42c7a35d3a5471474 100644 (file)
@@ -32,6 +32,7 @@ _kiwi.global = {
                }\r
 \r
                _.extend(this, Backbone.Events);\r
+               this._source = event_source;\r
 \r
                // Proxy the events to this dispatcher\r
                event_source.on('all', proxyEvent, this);\r
@@ -40,6 +41,7 @@ _kiwi.global = {
                this.dispose = function () {\r
                    event_source.off('all', proxyEvent);\r
                    this.off();\r
+                   delete this.event_source;\r
                };\r
            },\r
 \r
@@ -48,13 +50,14 @@ _kiwi.global = {
                var funcs = {\r
                        kiwi: 'kiwi', raw: 'raw', kick: 'kick', topic: 'topic',\r
                        part: 'part', join: 'join', action: 'action', ctcp: 'ctcp',\r
-                       notice: 'notice', msg: 'privmsg'\r
+                       notice: 'notice', msg: 'privmsg',\r
+                       get: 'get'\r
                };\r
 \r
                _.each(funcs, function(gateway_fn, func_name) {\r
                        obj[func_name] = function() {\r
                                var fn_name = gateway_fn;\r
-                               _kiwi.gateway[fn_name].apply(_kiwi.gateway, arguments);\r
+                               return _kiwi.gateway[fn_name].apply(_kiwi.gateway, arguments);\r
                        };\r
                });\r
 \r
@@ -68,7 +71,10 @@ _kiwi.global = {
                };\r
 \r
                _.each(funcs, function(controlbox_fn, func_name) {\r
-                       obj[func_name] = _kiwi.app.controlbox[controlbox_fn];\r
+                       obj[func_name] = function() {\r
+                               var fn_name = controlbox_fn;\r
+                               return _kiwi.app.controlbox[fn_name].apply(_kiwi.app.controlbox, arguments);\r
+                       };\r
                });\r
 \r
                return obj;\r