Mercurial > eldonilo > lightstring
comparison lightstring.js @ 77:7854e036a572
Fix a problem that made events without data called only once.
author | Sonny Piers <sonny.piers@gmail.com> |
---|---|
date | Mon, 06 Feb 2012 18:03:06 +0100 |
parents | 0b8e7ca19f83 |
children | 4d0fc1c9ec88 |
comparison
equal
deleted
inserted
replaced
76:0b8e7ca19f83 | 77:7854e036a572 |
---|---|
332 emit: function(aName, aData) { | 332 emit: function(aName, aData) { |
333 var handlers = this.handlers[aName]; | 333 var handlers = this.handlers[aName]; |
334 if (!handlers) | 334 if (!handlers) |
335 return; | 335 return; |
336 | 336 |
337 //No data events | |
338 if(!aData) { | |
339 for (var i = 0; i < handlers.length; i++) | |
340 handlers[i].call(this, aData); | |
341 | |
342 return; | |
343 } | |
344 | |
345 //Non-iq events | |
337 if (aData && aData.DOM && aData.DOM.localName !== 'iq') { | 346 if (aData && aData.DOM && aData.DOM.localName !== 'iq') { |
338 for (var i = 0; i < handlers.length; i++) | 347 for (var i = 0; i < handlers.length; i++) |
339 handlers[i].call(this, aData); | 348 handlers[i].call(this, aData); |
340 | 349 |
341 return; | 350 return; |
342 } | 351 } |
343 | 352 |
353 //Iq events | |
344 var ret; | 354 var ret; |
345 for (var i = 0; i < handlers.length; i++) { | 355 for (var i = 0; i < handlers.length; i++) { |
346 ret = handlers[i].call(this, aData); | 356 ret = handlers[i].call(this, aData); |
347 if (typeof ret !== 'boolean') | 357 if (typeof ret !== 'boolean') |
348 return; //TODO: error | 358 return; //TODO: error |