adding commenting/readability to triggerEvent()

git-svn-id: http://svn.openlayers.org/trunk/openlayers@863 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-07-04 11:18:06 +00:00
parent 9746ac23fe
commit 1301102b1a

View File

@@ -106,17 +106,26 @@ OpenLayers.Events.prototype = {
* @param {Event} evt
*/
triggerEvent: function (type, evt) {
// prep evt object with object & div references
if (evt == null) {
evt = {};
evt = new Object();
}
evt.object = this.object;
evt.div = this.div;
// execute all callbacks registered for specified type
var listeners = this.listeners[type];
for (var i = 0; i < listeners.length; i++) {
var callback = listeners[i];
// use the 'call' method to bind the context to callback.obj
var continueChain = callback.func.call(callback.obj, evt);
if (continueChain != null && !continueChain) break;
if ((continueChain != null) && (continueChain == false)) {
// if callback returns false, execute no more callbacks.
break;
}
}
},