spy calls to EventTarget.addEventListener @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener
320502
function eventSpyBefore(eventType) {
                    /* jshint validthis: true */
                    var path = phantomas.getDOMPath(this);
                    //phantomas.log('DOM event: "' + eventType + '" bound to "' + path + '"');

                    phantomas.incrMetric('eventsBound');
                    phantomas.addOffender('eventsBound', '"%s" bound to "%s"', eventType, path);
                    phantomas.log('event ' + eventType + ' bound');

                    phantomas.enterContext({
                        type: 'addEventListener',
                        callDetails: {
                            context: {
                                length: 1,
                                elements: [path]
                            },
                            arguments: [eventType]
                        },
                        backtrace: phantomas.getBacktrace()
                    });

                    // count window.addEventListener('scroll', ...) - issue #508
                    if (eventType === 'scroll' && (path === 'window' || path === '#document')) {
                        phantomas.incrMetric('eventsScrollBound');
                        phantomas.addOffender('eventsScrollBound', 'bound by %s on %s', phantomas.getBacktrace(), path);
                    }
                }
53016
function () {
    this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
    this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
    this.evWin && removeEventListeners(getDocumentForElement(this.element), this.evWin, this.domHandler);
  }
332171
function EventEmitter() {
  this._events = { };
  this._once   = { };
  // default to 10 max liseners
  this._maxListeners = 10;

  this._add = function (event, listener, once) {
    var entry = { listener: listener };
    if (once) {
      entry.once = true;
    }

    if (this._events[event]) {
      this._events[event].push(entry);
    } else {
      this._events[event] = [ entry ];
    }

    if (this._maxListeners && this._events[event].count > this._maxListeners && console && console.warn) {
      console.warn("EventEmitter Error: Maximum number of listeners");
    }

    return this;
  };

  this.on = function (event, listener) {
    return this._add(event, listener);
  };

  this.addListener = this.on;

  this.once = function (event, listener) {
    return this._add(event, listener, true);
  };

  this.removeListener = function (event, listener) {
    if (!this._events[event]) {
      return this;
    }

    for(var i = this._events.length-1; i--;) {
      if (this._events[i].listener === callback) {
        this._events.splice(i, 1);
      }
    }

    return this;
  };

  this.removeAllListeners = function (event) {
    this._events[event] = undefined;

    return this;
  };

  this.setMaxListeners = function (count) {
    this._maxListeners = count;

    return this;
  };

  this.emit = function () {
    var args = Array.prototype.slice.apply(arguments);
    var remove = [ ], i;

    if (args.length) {
      var event = args.shift();

      if (this._events[event]) {
        for (i = this._events[event].length; i--;) {
          this._events[event][i].listener.apply(null, args);
          if (this._events[event][i].once) {
            remove.push(listener);
          }
        }
      }

      for (i = remove.length; i--;) {
        this.removeListener(event, remove[i]);
      }
    }

    return this;
  };
}
182448
function addListener(target, eventType, fn) {
		target.attachEvent(eventType, fn);
		listenersArr[listenersArr.length] = [target, eventType, fn];
	}
652975
function addEventListener(event, listener) {
    this._eventListeners[event] = this._eventListeners[event] || [];
    this._eventListeners[event].push(listener);
  }
628947
protected void addTargetListeners (Component comp)
    {
        comp.addMouseListener(_targetListener);
        comp.addMouseMotionListener(_targetListener);
        if (comp instanceof Container) { // hm, always true for JComp..
            Container cont = (Container) comp;
            cont.addContainerListener(_childListener);
            for (int ii=0, nn=cont.getComponentCount(); ii < nn; ii++) {
                addTargetListeners(cont.getComponent(ii));
            }
        }
    }
1357955
function eventHandler(trackedElements = {}, options = { tolerance: 0 }) {
    const selectors = Object.keys(trackedElements);
    let testVisibility;

    if (!selectors.length) return;

    if (options.container === window) {
        testVisibility = inViewport;
    } else {
        testVisibility = inContainer;
    }

    selectors.forEach((selector) => {
        trackedElements[selector].nodes.forEach((item) => {
            if (testVisibility(item.node, options)) {
                item.wasVisible = item.isVisible;
                item.isVisible = true;
            } else {
                item.wasVisible = item.isVisible;
                item.isVisible = false;
            }
            if (item.isVisible === true && item.wasVisible === false) {
                if (!trackedElements[selector].enter) return;

                Object.keys(trackedElements[selector].enter).forEach((callback) => {
                    if (typeof trackedElements[selector].enter[callback] === 'function') {
                        trackedElements[selector].enter[callback](item.node, 'enter');
                    }
                });
            }
            if (item.isVisible === false && item.wasVisible === true) {
                if (!trackedElements[selector].leave) return;

                Object.keys(trackedElements[selector].leave).forEach((callback) => {
                    if (typeof trackedElements[selector].leave[callback] === 'function') {
                        trackedElements[selector].leave[callback](item.node, 'leave');
                    }
                });
            }
        });
    });
}
536760
function removeEventListener (event, listener) {
    if (hasDOM()) {
      eventEmitter.removeEventListener(event, listener);
    } else if (hasEventEmitter()) {
      eventEmitter.removeListener(event, listener);
    }
  }
737991
function addEvent(elem, event, fn) {
  if (elem.addEventListener) {
    elem.addEventListener(event, fn, false);
    return fn;
  } else {
    let fn2 = function() {
      // set the this pointer same as addEventListener when fn is called
      return(fn.call(elem, window.event));
    };
    elem.attachEvent("on" + event, fn2);
    return fn2;
  }
}
783267
public boolean addEventListener(IEventListener listener) {
        log.debug("addEventListener - scope: {} {}", getName(), listener);
        return listeners.add(listener);
    }
732794
function attachListener_() {
    if (isListening) { return; }
    isListening = true;

    unsubFunc = Events.eventListener(target, eventName, function() {
      if (outputStream.closed) {
        detachListener_();
      } else {
        Util.apply(boundEmit, arguments);
      }
    });

    onClose(outputStream, detachListener_);
  }
173206
function getListener(event, id) {
    if (hasListeners(event)) {
      var listeners = getListeners(event);

      if (_.has(listeners, id)) {
        return listeners[id];
      }
    }

    return false;
  }
530488
function addListener(obj, eventName, target, method) {
  Ember.assert("You must pass at least an object and event name to Ember.addListener", !!obj && !!eventName);

  if (!method && 'function' === typeof target) {
    method = target;
    target = null;
  }

  var actionSet = actionSetFor(obj, eventName, target, true),
      methodGuid = guidFor(method);

  if (!actionSet[methodGuid]) {
    actionSet[methodGuid] = { target: target, method: method };
  }

  if ('function' === typeof obj.didAddListener) {
    obj.didAddListener(eventName, target, method);
  }
}
130312
function callListeners(listeners) {
        var current_event_idx = -1;

        // Make sure we have some data to pass to the listeners
        event_data = event_data || undefined;

        // If no bound listeners for this event, leave now
        if (listeners.length === 0) {
            emitComplete();
            return;
        }


        // Call the next listener in our array
        function nextListener() {
            var listener, event_obj;

            // We want the next listener
            current_event_idx++;

            // If we've ran out of listeners end this emit call
            if (!listeners[current_event_idx]) {
                emitComplete();
                return;
            }

            // Object the listener ammends to tell us what it's going to do
            event_obj = {
                // If changed to true, expect this listener is going to callback
                wait: false,

                // If wait is true, this callback must be called to continue running listeners
                callback: function () {
                    // Invalidate this callback incase a listener decides to call it again
                    event_obj.callback = undefined;

                    nextListener.apply(that);
                },

                // Prevents the default 'done' functions from executing
                preventDefault: function () {
                    prevented = true;
                }
            };


            listener = listeners[current_event_idx];
            listener[1].call(listener[2] || that, event_obj, event_data);

            // If the listener hasn't signalled it's going to wait, proceed to next listener
            if (!event_obj.wait) {
                // Invalidate the callback just incase a listener decides to call it anyway
                event_obj.callback = undefined;

                nextListener();
            }
        }

        nextListener();
    }
763084
function () {
                var eventListeners = this._cfg ? this._cfg.on : null;
                if (eventListeners) {
                    for (var listener in eventListeners) {
                        if (eventListeners.hasOwnProperty(listener)) {
                            eventListeners[listener] = this.$normCallback(eventListeners[listener]);
                        }
                    }
                }
            }
45961
function() {
    var self = this;
    Pusher.EventsDispatcher.call(this);
    // This is okay, as IE doesn't support this stuff anyway.
    if (window.addEventListener !== undefined) {
      window.addEventListener("online", function() {
        self.emit('online', null);
      }, false);
      window.addEventListener("offline", function() {
        self.emit('offline', null);
      }, false);
    }
  }
907783
public void addEventListener(EventListener listener)
    throws IllegalArgumentException
    {
        
        if (listener instanceof HttpSessionAttributeListener)
            _sessionAttributeListeners.add(listener);
        if (listener instanceof HttpSessionListener)
            _sessionListeners.add(listener);
    }