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:
@@ -106,17 +106,26 @@ OpenLayers.Events.prototype = {
|
|||||||
* @param {Event} evt
|
* @param {Event} evt
|
||||||
*/
|
*/
|
||||||
triggerEvent: function (type, evt) {
|
triggerEvent: function (type, evt) {
|
||||||
|
|
||||||
|
// prep evt object with object & div references
|
||||||
if (evt == null) {
|
if (evt == null) {
|
||||||
evt = {};
|
evt = new Object();
|
||||||
}
|
}
|
||||||
evt.object = this.object;
|
evt.object = this.object;
|
||||||
evt.div = this.div;
|
evt.div = this.div;
|
||||||
|
|
||||||
|
// execute all callbacks registered for specified type
|
||||||
var listeners = this.listeners[type];
|
var listeners = this.listeners[type];
|
||||||
for (var i = 0; i < listeners.length; i++) {
|
for (var i = 0; i < listeners.length; i++) {
|
||||||
var callback = listeners[i];
|
var callback = listeners[i];
|
||||||
|
|
||||||
|
// use the 'call' method to bind the context to callback.obj
|
||||||
var continueChain = callback.func.call(callback.obj, evt);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user