Helper function to filter out the `this.events` array

@param {Function} handle the callback of the event
@api private
482264
function remove(handle) {
          return !(
              handle.callback === callback
            && (!context ? true : handle.context === context)
          );
        }
1203306
private boolean filter(Event event) {
        if (null == filters) return false;

        for (EventFilter filter : filters) {
            if (filter.filter(event)) {
                return true;
            }
        }
        return false;
    }
226453
function (handler) {
		return [
			{
				enabled: handler.deleteLastVertex,
				title: L.drawLocal.draw.toolbar.undo.title,
				text: L.drawLocal.draw.toolbar.undo.text,
				callback: handler.deleteLastVertex,
				context: handler
			},
			{
				title: L.drawLocal.draw.toolbar.actions.title,
				text: L.drawLocal.draw.toolbar.actions.text,
				callback: this.disable,
				context: this
			}
		];
	}
227653
function(events, handler) {
        if (events === undefined) {
            return;
        }
        if (handler === undefined) {
            return;
        }

        var handlers = this.handlers;
        each(splitStr(events), function(event) {
            handlers[event] = handlers[event] || [];
            handlers[event].push(handler);
        });
        return this;
    }
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;
    }
  }
922612
function(event, handler) {
    return events.off({
      listeners: this._listeners,
      event: event,
      handler: handler
    });
  }
695574
function() {

    this.on = this.addEventListener = function(type, listener) {
        if (!this.events[type]) {
            this.events[type] = [];
        }

        this.events[type].push(listener);
    };

    this.off = this.removeEventListener = function (type, listener) {
        if (!!this.events[type]) {
            for(var i = 0; i < this.events[type].length; i++) {
                if (this.events[type][i] === listener) {
                    this.events[type][i] = null;
                    this.events[type].splice(i, 1);
                    return;
                }
            }
        }
    };

    this.removeAllListeners = function (type) {
        this.events[type] = [];
    };

    var emit = function(cb, event) {
        // Handle callbacks asynchronously
        setTimeout(function() {
            cb(event);
        }, 0);

    };

    this.dispatchEvent = function (event) {
        if (!!event.type) {
            var type = event.type;
            if (!!this.events[type]) {
                event.target = this;
                for (var i = 0; i < this.events[type].length && (event.returnValue === undefined || event.returnValue) ; i++) {
                    var cb = this.events[type][i];
                    // Dereference cb for async
                    emit(cb.bind(event.target), event);
                }
            }
        }
    };
}
591444
function (eventType, callback, scope) {
                if (!eventType) {
                    // remove all events
                    this._eventHandlers = {};
                } else if (!callback) {
                    // remove all callbacks for these event
                    this._eventHandlers[eventType] = [];
                } else if (this._eventHandlers[eventType]) {
                    var list = this._eventHandlers[eventType];
                    for (var i = list.length - 1; i >= 0; i--) {
                        if (list[i].$callback == callback && (!scope || scope === list[i].scope)) {
                            list.splice(i, 1);  // delete callback
                        }
                    }
                }
            }
1153697
def _remove(self, handler, send_event=True):
        
        for event in self:
            event.remove_handlers_bound_to_instance(handler)
        self.handlers.remove(handler)
        if send_event:
            self.on_handler_remove(handler)
238895
function listenersHelp (element, events, handler, method) {
  let list = events.split(' ')
  for (let i = 0, len = list.length; i < len; i++) {
    let item = list[i]
    if (method === false) {
      element.removeEventListener(item, handler)
    } else {
      element.addEventListener(item, handler, false)
    }
  }
}
1307819
function offEvent(gesture, handler){
      var gestures = gesture.split(' ');
      for(var t=0; t<gestures.length; t++) {
        this.element.removeEventListener(gestures[t], handler, false);
      }
      return this;
    }
544461
function (eventName,handler) {
			var event;
			if (event = this.getEvent(eventName))
			{
				if (!event.prependListener(handler))
					this.e.log('Invalid handler sent to event `'+eventName+'` on `'+this.getConfig('id')+'`','warning');
			} else
				this.e.log('Not existent event `'+eventName+'` on `'+this.getConfig('id')+'`','warning');
			return this;
		}
878587
function( name, cb, ctx ) {
                var events = this._events;
    
                if ( !events ) {
                    return this;
                }
    
                if ( !name && !cb && !ctx ) {
                    this._events = [];
                    return this;
                }
    
                eachEvent( name, cb, function( name, cb ) {
                    $.each( findHandlers( events, name, cb, ctx ), function() {
                        delete events[ this.id ];
                    });
                });
    
                return this;
            }
839810
function(callbacks, context){
      // avoid warnings on trying to remove handler for destroyed instance
      // since it droped all handlers
      if (this.destroy === warnOnDestroy)
        return;

      var cursor = this;
      var prev;

      context = context || this;

      // search for handler and remove it
      while (prev = cursor, cursor = cursor.handler)
        if (cursor.callbacks === callbacks && cursor.context === context)
        {
          // make it non-callable
          cursor.callbacks = NULL_HANDLER;

          // remove from list
          prev.handler = cursor.handler;

          return;
        }

      // handler not found
      /** @cut */ basis.dev.warn(namespace + '.Emitter#removeHandler: no handler removed');
    }
820302
def _attach_handler_events(self, handler, events=None):
        
        if not events:
            events = self
        for name in events:
            meth = getattr(handler, name, None)
            if meth:
                self.events[name] += meth
154428
function clearEventHandlers($event = null)
	{
		if (!empty($event)) {
			$this->_events[$event] = array();
		}
		else {
			$this->_events = array();
		}
	}
471781
function(object, events, callback) {
      var listeners = this._listeners;
      if (!listeners) return;
      if (object) {
        object.off(events, callback, this);
        if (!events && !callback) delete listeners[object._listenerId];
      } else {
        for (var id in listeners) {
          listeners[id].off(null, null, this);
        }
        this._listeners = {};
      }
      return this;
    }