Invoke an event handler.
193107
def _trigger_event(self, event, *args, **kwargs):
        """"""
        run_async = kwargs.pop('run_async', False)
        if event in self.handlers:
            if run_async:
                return self.start_background_task(self.handlers[event], *args)
            else:
                try:
                    return self.handlers[event](*args)
                except:
                    self.logger.exception(event + ' handler error')
648515
def _handle_event(self, sid, namespace, id, data):
        """"""
        namespace = namespace or '/'
        self.logger.info('received event "%s" from %s [%s]', data[0], sid,
                         namespace)
        if self.async_handlers:
            self.start_background_task(self._handle_event_internal, self, sid,
                                       data, namespace, id)
        else:
            self._handle_event_internal(self, sid, data, namespace, id)
779039
function(event, handler) {
    return events.on({
      listeners: this._listeners,
      event: event,
      handler: handler
    });
  }
328831
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
    public void invoke(EventBase<?> event) throws Throwable {
        // ADAPT VERBOSEHANDLERREFERENCE TO ANY CHANGES MADE HERE
        switch (method.type().parameterCount()) {
        case 0:
            // No parameters
            method.invoke();
            break;

        case 1:
            // Event parameter
            method.invoke(event);
            break;

        case 2:
            // Event and channel
            Class<?> channelParam = method.type().parameterType(1);
            for (Channel channel : event.channels()) {
                if (channelParam.isAssignableFrom(channel.getClass())) {
                    method.invoke(event, channel);
                }
            }
            break;

        default:
            throw new IllegalStateException("Handle not usable");
        }
    }
48996
def _handle(self, event_handler, event_name, user_args, event_timeout,
                cond, cond_timeout):
        
        if cond:
            cond.wait(cond_timeout)
        event = self.pop_event(event_name, event_timeout)
        return event_handler(event, *user_args)
307923
def event_handler(msg: EventMsgDict) -> Event:
    """"""
    e = create_event_from_msg(msg)
    if e.currentTarget is None:
        if e.type not in ['mount', 'unmount']:
            id = msg['currentTarget']['id']
            logger.warning('No such element: wdom_id={}'.format(id))
        return e
    e.currentTarget.on_event_pre(e)
    e.currentTarget.dispatchEvent(e)
    return e
128517
function invoke(id) {
  this.isPending[id] = true;
  this.callbacks[id](this.pendingPayload);
  this.isHandled[id] = true;
}
323863
def fire(self, *args, **kwargs):

        

        for func in self._getfunctionlist():
            if type(func) == EventHandler:
                func.fire(*args, **kwargs)
            else:
                func(self.obj, *args, **kwargs)
1327550
function handler() {
		// Get the current orientation.
		var orientation = get_orientation();

		if ( orientation !== last_orientation ) {
			// The orientation has changed, so trigger the orientationchange event.
			last_orientation = orientation;
			win.trigger( event_name );
		}
	}
1025605
async def _trigger_event(self, event, *args, **kwargs):
        """"""
        run_async = kwargs.pop('run_async', False)
        ret = None
        if event in self.handlers:
            if asyncio.iscoroutinefunction(self.handlers[event]) is True:
                if run_async:
                    return self.start_background_task(self.handlers[event],
                                                      *args)
                else:
                    try:
                        ret = await self.handlers[event](*args)
                    except asyncio.CancelledError:  # pragma: no cover
                        pass
                    except:
                        self.logger.exception(event + ' async handler error')
                        if event == 'connect':
                            # if connect handler raised error we reject the
                            # connection
                            return False
            else:
                if run_async:
                    async def async_handler():
                        return self.handlers[event](*args)

                    return self.start_background_task(async_handler)
                else:
                    try:
                        ret = self.handlers[event](*args)
                    except:
                        self.logger.exception(event + ' handler error')
                        if event == 'connect':
                            # if connect handler raised error we reject the
                            # connection
                            return False
        return ret
589856
def _function_handler(function, args, kwargs, pipe):
    """"""
    signal.signal(signal.SIGINT, signal.SIG_IGN)

    result = process_execute(function, *args, **kwargs)

    send_result(pipe, result)
1152439
def on_event(event_handler = nil, &block)
      event_handler ||= block
      raise ArgumentError, "no event_handler provided" if event_handler.nil?
      @event_handler = event_handler
    end
1070616
def fire(self, *args, **kwargs):
        """"""
        if self.eventmanager:
            # Fire global event. Assuming we have an eventmanager.
            self.eventmanager.got_event(self.name, *args, **kwargs)

        for handler in self:  # Iterate over handlers
            try:
                handler(*args, **kwargs)  # Execute handler with given args.
            except StopIteration:  # Stop iterating if handler raised StopIter
                break
1341356
function on(element, type, handler, opt) {
    util.addEventListener(element, type, handler, opt, true);
  }
678024
function handleEvent(cmd, context, filename, callback) {
  var event = JSON.parse(cmd)
  eventline.route(event)
}
1362852
def on(self, event, handler=None):
        """"""
        if isinstance(event, str) and ' ' in event:  # event is list str-based
            self.on(event.split(' '), handler)
        elif isinstance(event, list):  # many events contains same handler
            for each in event:
                self.on(each, handler)
        elif isinstance(event, dict):  # event is a dict of <event, handler>
            for key, value in event.items():
                self.on(key, value)
        elif isinstance(handler, list):  # handler is a list of handlers
            for each in handler:
                self.on(event, each)
        elif isinstance(handler, Event):  # handler is Event object
            self.events[event] = handler  # add or update an event
            setattr(self, event, self.events[event])  # self.event.trigger()
        elif event in self.events:  # add a handler to an existing event
            self.events[event].on(handler)
        else:  # create new event with a handler attached
            self.on(event, Event(handler))
624766
@Override
	public final void invoke() {
		if (index < inters.length)
			inters[index++].intercept(this);
		else if (index++ == inters.length)
			invocation.invoke();
	}