// Event managers for plugins\r
components: {\r
EventComponent: function(event_source, proxy_event_name) {\r
+ /*\r
+ * proxyEvent() listens for events then re-triggers them on its own\r
+ * event emitter. Why? So we can .off() on this emitter without\r
+ * effecting the source of events. Handy for plugins that we don't\r
+ * trust meddling with the core events.\r
+ *\r
+ * If listening for 'all' events the arguments are as follows:\r
+ * 1. Name of the triggered event\r
+ * 2. The event data\r
+ * For all other events, we only have one argument:\r
+ * 1. The event data\r
+ *\r
+ * When this is used via `new kiwi.components.Network()`, this listens\r
+ * for 'all' events so the first argument is the event name which is\r
+ * the connection ID. We don't want to re-trigger this event name so\r
+ * we need to juggle the arguments to find the real event name we want\r
+ * to emit.\r
+ */\r
function proxyEvent(event_name, event_data) {\r
- if (proxy_event_name !== 'all') {\r
+ if (proxy_event_name == 'all') {\r
+ event_name = event_data.event_name;\r
+ event_data = event_data.event_data;\r
+ } else {\r
event_data = event_name.event_data;\r
event_name = event_name.event_name;\r
}\r