The document describes a Node Knockout entry called TweetIRC that allows users to follow Twitter sources in a chatroom-like interface. It discusses how TweetIRC was built using Node.js on the backend with a Dojo-based frontend. Key aspects included a plugin framework to handle features and messaging, with the kernel class managing registration and communication between plugins.
6. My (solo) team was “Celestial Being”, 10 th place “Overall” About nodeko
7.
8. User interface built upon Diijit, inheriting its high-quality widgets browser support and flexibility
9. Will allow the user to “follow” a large number of Twitter “sources” (searches, users, lists, …) in a compact and user friendly interface About TweetIRC
23. Chatrooms are a custom TweetIRC.ChatRoom class which extends dijit.layout.BorderContainer
24. London Ajax User Group: JavaScript MiniConf (18 th September 2010) dijit.layout.BorderContainer
25. London Ajax User Group: JavaScript MiniConf (18 th September 2010) The kernel class definition dojo.provide('TweetIRC.Kernel'); dojo.declare("TweetIRC.Kernel", null, { registerPlugin: function(plugin); onTimerTick: function(); onGlobalMessage: function(message); onMessage: function(message); onCommand: function(event); startup: function(/* Object */args); }
26. London Ajax User Group: JavaScript MiniConf (18 th September 2010) The kernel class use dojo.ready(function(){ var kernel = new TweetIRC.Kernel(); // Register plugins kernel.registerPlugin(new TweetIRC.plugins.ChatRoomPlugin()); kernel.registerPlugin(new TweetIRC.plugins.NodeKOPlugin()); kernel.startup(); // Force 1st tick kernel.onTimerTick(); });
27. London Ajax User Group: JavaScript MiniConf (18 th September 2010) Plugins dojo.declare("TweetIRC.BasePlugin", null, { _features: {}, _commands: [], ...
29. London Ajax User Group: JavaScript MiniConf (18 th September 2010) Messaging dojo.publish("/commands", [{publisher:this, command:'/JOIN #dojo'}]); Pushing messages is easy, from anywhere on the browser onCommand: function(event) { if (event.command.indexOf('/')===0) { <...> for (var i=0; i<this._registeredPlugins.length; i++) { var plugin = this._registeredPlugins[i]; if (plugin.hasFeature('TweetIRC.features.CommandListener') && plugin.hasCommand(command)) { plugin.onCommand(command, args, event); }}} Goes into kernel …
30. London Ajax User Group: JavaScript MiniConf (18 th September 2010) Messaging /** * Handler for /commands */ onCommand: function(command, args, event) { //console.debug("got command:"+command); //console.debug(args, event); if(command==='JOIN' || command==='J') { this._JOIN(args[0]); } }, … and ends in a plugin
35. London Ajax User Group: JavaScript MiniConf (18 th September 2010) The end Q. & A. José Moreira http://zemanel.eu http://twitter.com/zemanel http://pt.linkedin.com/in/josemoreira