Call this function to pre extend the passed event.
@param {Object}   evt      The event object
@param {Function} callback The function that will be called when this action has finished [optional]
`function(errs, preExtendedEvent){}`
973376
function (evt, callback) {
    var self = this;

    var extendedEvent = evt;

    var eventExtender = self.tree.getPreEventExtender(self.eventDispatcher.getTargetInformation(evt));

    if (!eventExtender) {
      return callback(null, extendedEvent);
    }

    eventExtender.extend(extendedEvent, function (err, extEvt) {
      if (err) {
        debug(err);
      }
      extendedEvent = extEvt || extendedEvent;
      callback(err, extendedEvent);
    });
  }
867322
function ready(callback = null) {
    let promise = new Promise((resolve) => {
        if (document.readyState === "complete") {
            return resolve();
        }

        document.addEventListener("DOMContentLoaded", () => {
            resolve();
        });
    });

    return (typeof callback === "function") ?
        promise.then(callback) :
        promise;
}
960798
function (evt) {
            if(this.fireEvent('before' + evt.type.replace(/^on/, '').toLowerCase()) === false){
                return false;
            }
            if(this.fireEvent(evt.type.replace(/^on/, ''), evt) === false){
                return false;
            }
            return this.fireEvent('after' + evt.type.replace(/^on/, '').toLowerCase())
        }
909686
function(evt) {
        delete this.startEvt;
        var features = this.getFeatures(evt);
        var over = {}, newly = [], feature;
        for (var i=0, len=features.length; i<len; ++i) {
            feature = features[i];
            over[feature.id] = feature;
            if (!this.cache[feature.id]) {
                newly.push(feature);
            }
        }
        // check if already over features
        var out = [];
        for (var id in this.cache) {
            feature = this.cache[id];
            if (feature.layer && feature.layer.map) {
                if (!over[feature.id]) {
                    out.push(feature);
                }
            } else {
                // removed
                delete this.cache[id];
            }
        }
        // fire featureover events
        var more;
        for (i=0, len=newly.length; i<len; ++i) {
            feature = newly[i];
            this.cache[feature.id] = feature;
            more = this.triggerEvent("featureover", {feature: feature});
            if (more === false) {
                break;
            }
        }
        // fire featureout events
        for (i=0, len=out.length; i<len; ++i) {
            feature = out[i];
            delete this.cache[feature.id];
            more = this.triggerEvent("featureout", {feature: feature});
            if (more === false) {
                break;
            }
        }
    }
562299
function(evname, callback, context) {
    if (!evname && !callback && !context) {
      this._events = {};
      return this;
    } else if (!evname) {
      for (var _evname in this._events) {
        this.off(_evname, callback, context);
      }
      return this;
    } else {
      var fns = this._events[evname], l = fns.length;
      while (l--) {
        if ((callback ? fns[l].cb === callback : true) && (context ? fns[l].ctxt === context : true)) {
          fns.splice(l, 1);
        }
      }
      return this;
    }
  }
1357029
function (evt) {
        var propagate = true;
        this.dragging = false;
        if (this.checkModifiers(evt) &&
               (OpenLayers.Event.isLeftClick(evt) ||
                OpenLayers.Event.isSingleTouch(evt))) {
            this.started = true;
            this.start = evt.xy;
            this.last = evt.xy;
            OpenLayers.Element.addClass(
                this.map.viewPortDiv, "olDragDown"
            );
            this.down(evt);
            this.callback("down", [evt.xy]);

            // prevent document dragging
            OpenLayers.Event.preventDefault(evt);

            if(!this.oldOnselectstart) {
                this.oldOnselectstart = document.onselectstart ?
                    document.onselectstart : OpenLayers.Function.True;
            }
            document.onselectstart = OpenLayers.Function.False;

            propagate = !this.stopDown;
        } else {
            this.started = false;
            this.start = null;
            this.last = null;
        }
        return propagate;
    }
577494
function(evt) {
            var e = {
              target: this,
              type: evt.type,
              evt: evt
            };
            this.fire(evt.type, e);
        }
204117
function(callback){
        for(this._itr; this._itr < this._data.length; this._itr++) {
            this._testFunction.call(this, this._itr);
        }

        callback.call(this, this._res);
	}
85206
def push_event(self, evt):
        """"""
        try:
            self._push_event(evt)
        except Exception as e:
            print("Unexpected error in callback for %s: %s"
                  % (str(evt), str(e)), file=self._fd)
449360
function (eventType, evt) {
    if (!this.eventListeners) {
      this.eventListeners = {};
    }
    if (!evt) {
      evt = {};
    }
    evt.type = eventType;
    if (!evt.source) {
      evt.source = this;
    }
    var events = this.eventListeners[eventType];
    if (events) {
      var len = events.length;
      for (var i = 0; i < len; i++) {
        events[i].handler.apply(this, [evt]);
      }
    }
    return this;
  }
905480
function doOnce(fn) {
    var called = false;
    return function() {
      if (called) throw new Error("Callback already called.");
      called = true;
      fn.apply(root, arguments);
    };
  }
1060214
function(evt) {
                    // console.log("110"+" onpress: "+Math.random()+" "+ evt.type);
                    if(! _dragEnabled)return;

                    if (isClickableElement(evt)) {
                        return;
                    }

                    if (evt.type == "mousedown" && evt.button != 0) {
                        // Do not start dragging on right-click
                        return;
                    }

                    var useTouch = evt.type === 'touchstart' ? true : false;


                    if(useTouch){
                        cancelPress();
                        _pressTimer = setTimeout(function(){
                            cancelPress();
                            onlongpress(evt);
                            onmove(evt);
                        },ngDraggable.touchTimeout);
                        $document.on(_moveEvents, cancelPress);
                        $document.on(_releaseEvents, cancelPress);
                    }else{
                        onlongpress(evt);
                    }

                }
1107346
function makeCallback(callback) {
  if (_.isFunction(callback)) {
    return callback;
  }
  var result = function() { return callback; };
  result._callback = callback;
  return result;
}
1291177
function (e) { 
                var e = e || window.event; 

                if (typeof callback === 'function') {
                    callback.call(ctx, e);
                }
            }
1248155
function(type, evt) {
			var state = this._eventTypes ? this._eventTypes[type] : null;
			if (state) {
				var listeners = state.listeners;
				try {
					state.level++;
					if (listeners) {
						for (var i=0, len=listeners.length; i < len; i++) {
							if (listeners[i]) {
								var l = listeners[i].listener;
								if (typeof l === "function") {
									l.call(this, evt);
								} else if (l.handleEvent && typeof l.handleEvent === "function") {
									l.handleEvent(evt);
								}
							}
						}
					}
				} finally {
					state.level--;
					if (state.compact && state.level === 0) {
						for (var j=listeners.length - 1; j >= 0; j--) {
							if (!listeners[j]) {
								listeners.splice(j, 1);
							}
						}
						if (listeners.length === 0) {
							delete this._eventTypes[type];
						}
						state.compact = false;
					}
				}
			}
		}
907211
function (evt) {
            if (!this.__delegateMapping) {
                // there is no event listener
                if (evt.$DomEvent) {
                    evt.$dispose();
                }
                return;
            }

            if (!this.__stackCache) {
                this.__stackCache = {};
            }

            var depth = this.depth, stack = [], cacheStack, expandoValue, target;
            var stopper = Aria.$window.document.body;

            evt = this.__wrapEvent(evt);

            // Retrieve DOM corresponding to a widget
            target = evt.target;

            // flag to distinguish elements defined through aria templates
            var ATflag = false; // stays false if the target has not been generated with AT

            // retrieve dom that might contain delegation
            while (depth && target && target != stopper) {
                if (target.attributes) {
                    expandoValue = target.attributes[this.delegateExpando];
                    if (expandoValue) {
                        ATflag = true;
                        expandoValue = expandoValue.value;
                        cacheStack = this.__stackCache[expandoValue];

                        // search the cache for existing hierachy
                        if (cacheStack) {
                            // find value -> merge with existing hierarchy
                            stack = stack.concat(cacheStack);
                            break;
                        } else {
                            stack.push({
                                expandoValue : expandoValue,
                                target : target
                            });
                        }
                    }
                }
                target = target.parentNode;
                depth--;
            }

            var callback, delegateConfig;

            // will be used to track changes
            var nested = false;
            if (this._changed) {
                nested = true;
            } else {
                this._changed = {};
            }

            for (var i = 0, l = stack.length; i < l; i++) {
                delegateConfig = stack[i];
                expandoValue = delegateConfig.expandoValue;
                target = delegateConfig.target;

                // store hierarchy in cache : index 0 is the start point
                if (i === 0) {
                    this.__stackCache[expandoValue] = stack;
                }

                // if this id has been removed, don't proceed this callback
                if (this._changed[expandoValue]) {
                    continue;
                }

                // retrieve callback (cost nearly nothing, even in big objects)
                callback = this.__delegateMapping[expandoValue];

                evt.delegateTarget = target;

                // only stop bubbling if callback returned false -> strict equal
                // Callback might be null has a sub delegation might have destroyed it
                var result;
                if (callback) {
                    try {
                        result = callback.call(evt);
                    } catch (e) {
                        this.$logError(this.DELEGATE_UTIL_CALLBACK_FAIL, [evt.type], e);
                    }
                }

                // return false or hasStopPropagation stop bubbling
                if (result === false || evt.hasStopPropagation) {
                    break;
                }

                target = null;
            }

            if (!nested) {
                this._changed = null;
            }

            if (result !== false && !evt.hasStopPropagation && aria.templates) {
                // handle global navigation
                var navManager = aria.templates.NavigationManager;
                if (navManager) {
                    navManager.handleGlobalNavigation(evt);
                }
            }

            // focus tracking
            if (evt.type == "focus") {
                this._focusedElementRemoved = false;
                this._focusTracking = evt.target;
                if (this._focusTracking && ATflag) {

                    this.$raiseEvent({
                        name : "elementFocused",
                        focusedElement : this._focusTracking
                    });
                }
            } else if (evt.type == "blur") {

                if (ATflag) {
                    this.$raiseEvent({
                        name : "elementBlurred",
                        blurredElement : this._focusTracking
                    });
                }
                this._focusTracking = null;
            }

            // dispose event
            evt.$dispose();

        }
71303
function(evt) {
        var layer = evt.layer;
        if (layer instanceof OpenLayers.Layer.Grid) {
            layer.events.on({
                addtile: this.addTile,
                retile: this.clearTileQueue,
                scope: this
            });
            var i, j, tile;
            for (i=layer.grid.length-1; i>=0; --i) {
                for (j=layer.grid[i].length-1; j>=0; --j) {
                    tile = layer.grid[i][j];
                    this.addTile({tile: tile});
                    if (tile.url && !tile.imgDiv) {
                        this.manageTileCache({object: tile});
                    }
                }
            }
        }
    }