Call the listener
@param {function} listener
@param {object} event object
431516
function (listener,evtObj)
		{
			if (!_.isFunction(listener) || !_.isObject(evtObj))
				return false;

			var args = evtObj.arguments;			
			switch (args.length)
			{
				case 1:
					listener(args[0]);
					break;
				case 2:
					listener(args[0],args[1]);
					break;
				case 3:
					listener(args[0],args[1],args[2]);
					break;
				case 4:
					listener(args[0],args[1],args[2],args[3]);
					break;
				case 5:
					listener(args[0],args[1],args[2],args[3],args[4]);
					break;
				default:
					listener.apply(undefined,args);
			}
		}
622486
function (object, event, callback) {
        var index = this.indexOf(object);
        var listener = this.listeners[index];
        if (listener) {
            var callbacks = listener.events[event];
            if (callbacks) {
                var index = callbacks.indexOf(callback);
                if (index != -1) {
                    callbacks.splice(index, 1);
                }

                // remove the array when empty
                if (callbacks.length == 0) {
                    delete listener.events[event];
                }
            }

            // count the number of registered events. remove listener when empty
            var count = 0;
            var events = listener.events;
            for (var e in events) {
                if (events.hasOwnProperty(e)) {
                    count++;
                }
            }
            if (count == 0) {
                delete this.listeners[index];
            }
        }
    }
1089633
function addListener(element, listener) {
        var id = idHandler.get(element);

        if(!eventListeners[id]) {
            eventListeners[id] = [];
        }

        eventListeners[id].push(listener);
    }
345918
function(event_name, event_args) {

		if (Lava.schema.DEBUG && typeof(event_name) == "undefined") Lava.t();

		if (this._listeners[event_name] != null) {

			this._callListeners(this._listeners[event_name], event_args);

		}

	}
1162768
function ListenerAbstract(object, layerID) {
		var self = this;

		this.layerID = layerID;
		this.connections = {};
		this.online = false;
		this.object = object;
		this.handlers = {};

		this.on('listening', function () {
			self.online = true;
		});
		this.on('close', function () {
			self.online = false;
		});
	}
142190
function(event, name) {

            var eventListeners = this.__getEventListeners(event);

            if (!(name in eventListeners)) {
                throw new Error('Event listener for event "' + event + '" with name "' + name + '" does not exist!');
            }

            return eventListeners[event][name];
        }
695994
function (element, events, func) {
            for (var i = 0; i < events.length; i++) {
                element.addEventListener(events[i], func);
            }
        }
877435
function fire(event) {
		if (typeof event !== 'string') {
			throw new Error('"event" not a string');
		}

		// any listeners registered?
		if (!hasListeners(event)) {
			return triggerObject;
		}

		// get optional arguments
		var args = Array.prototype.slice.call(arguments, 1);

		// invoke listener functions
		listeners[event].slice(0).forEach(function(fn) {
			fn.apply(global, args);
		});

		return triggerObject;
	}
696415
public function it_should_call_listeners_for_their_events_when_event_is_triggered(
        MockListener $listener,
        Event $event
    ) {
        $event->hasBeenHandled()
              ->willReturn(\false);
        $listener->method1($event, 'test1', $this)
                 ->willReturn($event);
        $this->addListener('test1', [$listener, 'method1']);
        $this->getListeners()
             ->shouldHaveKey('test1');
        $listener->method1($event, 'test1', $this)
                 ->shouldBeCalled();
        $this->trigger('test1', $event);
    }
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();
    }
707614
function addListener(id, event, listener) {
    if (!hasListeners(event)) {
      context._events[event] = {};
    }
    
    context._events[event][id] = listener;

    return id;
  }
219917
def add_listener(event, &block)
      fail ArgumentError, 'must provide callback' unless block_given?
      listeners(event.to_sym).push block
    end
915287
function(listener) {
  // Check that listener has the required functions
  var events = ['comment', 'tag', 'feature', 'background', 'scenario', 'scenario_outline', 'examples', 'step', 'doc_string', 'row', 'eof'];
  for(var i=0, len=events.length; i<len; i++) {
    var event = events[i];
    if(typeof listener[event] != 'function') {
      throw new Error("Error. No " + event + " function exists on " + JSON.stringify(listener));
    }
  }
  this.listener = listener;
}
968173
@SuppressWarnings("unchecked")
  public Listener<Void> onEvent(String event, Runnable callback) {
    return onEvent(event, v -> callback.run());
  }
526499
def dispatchEvent(self, event, *args):
        
        for callback in self.listeners[event]:
            yield callback(event, self, *args)
791857
function(listener) {
        // Check that listener has the required functions
        var events = ['comment', 'tag', 'feature', 'background', 'scenario', 'scenario_outline', 'examples', 'step', 'doc_string', 'row', 'eof'];
        for(e in events) {
          var event = events[e];
          if(typeof listener[event] != 'function') {
            "Error. No " + event + " function exists on " + JSON.stringify(listener);
          }
        }
        this.listener = listener;
      }
692587
function on(event, listener) {
    // call from main process always.

    // add listener to common event emitter for main process.
    cee.on(event, function(id, data, ipcEvent) {
      listener(data, ipcEvent)
        .then(function(result) {
          cee.emit(getSuccessEventName(event, id), result);
        })
        .catch(function(result) {
          cee.emit(getFailureEventName(event, id), result);
        });
    });
  }