comparison lightstring.js @ 54:0b7dd59e264a

Fix Connection.load and add the init method to plugins.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 01 Feb 2012 04:08:15 +0100
parents 63c1c8bc8c19
children aaad98b33f86
comparison
equal deleted inserted replaced
53:d1a7895b3dce 54:0b7dd59e264a
392 var plugin = Lightstring.plugins[name]; 392 var plugin = Lightstring.plugins[name];
393 393
394 for (var ns in plugin.namespaces) 394 for (var ns in plugin.namespaces)
395 Lightstring.ns[ns] = plugin.namespaces[ns]; 395 Lightstring.ns[ns] = plugin.namespaces[ns];
396 396
397 Lightstring.stanzas[name] = {};
397 for (var stanza in plugin.stanzas) 398 for (var stanza in plugin.stanzas)
398 Lightstring.stanzas[name][stanza] = plugin.stanzas[stanza]; 399 Lightstring.stanzas[name][stanza] = plugin.stanzas[stanza];
399 400
400 for (var handler in plugin.handlers) 401 for (var handler in plugin.handlers)
401 this.on(handler, plugin.handlers[handler]); 402 this.on(handler, plugin.handlers[handler]);
402 403
403 for (var method in plugin.methods) 404 this[name] = plugin.methods;
404 this[name][method] = plugin.methods[method]; 405
406 if (plugin.init)
407 plugin.init();
405 } 408 }
406 }, 409 },
407 /** 410 /**
408 * @function Emits an event. 411 * @function Emits an event.
409 * @param {String} aName The event name. 412 * @param {String} aName The event name.