From a1629e091294ffef0aef5742a767ee74012598d3 Mon Sep 17 00:00:00 2001 From: Darren Date: Fri, 22 Feb 2013 20:14:42 +0000 Subject: [PATCH] Irc component renamed; Kiwi network events; --- client/assets/dev/app.js | 3 ++- client/assets/dev/model_gateway.js | 8 ++++---- client/assets/plugin_example.html | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/client/assets/dev/app.js b/client/assets/dev/app.js index c6b4370..c6d2835 100644 --- a/client/assets/dev/app.js +++ b/client/assets/dev/app.js @@ -43,7 +43,7 @@ _kiwi.global = { }; }, - Irc: function() { + Network: function() { var obj = new this.EventComponent(_kiwi.gateway); var funcs = { kiwi: 'kiwi', raw: 'raw', kick: 'kick', topic: 'topic', @@ -57,6 +57,7 @@ _kiwi.global = { return obj; }, + ControlInput: function() { var obj = new this.EventComponent(_kiwi.app.controlbox); var funcs = { diff --git a/client/assets/dev/model_gateway.js b/client/assets/dev/model_gateway.js index c9ccf01..61c6a45 100644 --- a/client/assets/dev/model_gateway.js +++ b/client/assets/dev/model_gateway.js @@ -54,9 +54,8 @@ _kiwi.model.Gateway = function () { this.applyEventHandlers = function () { /* - TODO: Impliment event 'groups' to remove a listener group - kiwi.gateway.on('msg:#channel', my_function); - kiwi.gateway.on('msg:somenick', my_function); + kiwi.gateway.on('message:#channel', my_function); + kiwi.gateway.on('message:somenick', my_function); kiwi.gateway.on('notice:#channel', my_function); kiwi.gateway.on('action:somenick', my_function); @@ -218,7 +217,8 @@ _kiwi.model.Gateway = function () { this.parseKiwi = function (command, data) { - console.log('kiwi event', command, data); + this.trigger('kiwi:' + command, data); + this.trigger('kiwi', data); }; /* Events: diff --git a/client/assets/plugin_example.html b/client/assets/plugin_example.html index d9393dd..8044097 100644 --- a/client/assets/plugin_example.html +++ b/client/assets/plugin_example.html @@ -41,16 +41,17 @@ this.set('title', 'Canvas Design'); this.view = new view({model: this}); - var irc = kiwi.components.Irc(); + var net = kiwi.components.Network(); var input = kiwi.components.ControlInput(); this.on('applet_loaded', function () { - irc.on('message', function () { + net.on('message', function () { var bar = that.view.$el.find('.bar'); bar.width(bar.width()+1); }); }); + net.on('kiwi', function (event) { console.log('kiwi', event); }); input.on('command:graph', function (event) { console.log(event); }); }, -- 2.25.1