Pass the specific arguments / block to all of the
 event handlers.  Return true if there was at least
 1 event handler; return false otherwise.
768487
def call(*args, &block)
      if @handlers.empty?
        return false
      else
        # TODO: Add some form of error-handling
        @handlers.each do |h|
          h.call(*args, &block)
        end

        return true
      end
    end
87934
function (arg1, arg2) {
    if (typeof arg1 !== 'string') throw 'First argument of param function must be a param name string.';
    if (typeof arg2 !== 'function') throw 'Second argument of param function must be a function.';
    
    _params.push({
      name: arg1,
      handler: arg2
    });
  }
1148899
def trigger(self, event: str, *args: T.Any, **kw: T.Any) -> bool:
        """"""

        callbacks = list(self._events.get(event, []))
        if not callbacks:
            return False

        for callback in callbacks:
            callback(*args, **kw)
        return True
1359545
def __yield_handlers(self, event_type):
        
        if event_type not in self.event_types:
            raise ValueError("%r not found in %r.event_types == %r" % (event_type, self, self.event_types))

        # Search handler stack for matching event handlers
        for frame in list(self._event_stack):
            if event_type in frame:
                yield frame[event_type]

        # Check instance for an event handler
        if hasattr(self, event_type):
            yield getattr(self, event_type)
1339804
def bind(self, event_name, callback):
        

        if event_name not in self.event_callbacks.keys():
            self.event_callbacks[event_name] = []

        self.event_callbacks[event_name].append(callback)
335376
function triggerListeners(listeners, event, args)
  {
    if (listeners && event in listeners)
    {
      var eventListeners = listeners[ event ];
      var triggerGroup = ++triggerId;
      var next, node = eventListeners.next;

      while (node !== eventListeners)
      {
        next = node.next;
        node.trigger( triggerGroup, args, false );
        node = next;
      }

      node = eventListeners.next;

      while (node !== eventListeners)
      {
        next = node.next;
        node.trigger( triggerGroup, args, true );
        node = next;
      }
    }
  }
596275
def get_handlers(self, event: str) -> T.List[T.Callable]:
        """"""

        return list(self._events.get(event, []))
944663
function triggerEvents (list, args, context) {
  var pass = true

  if (list) {
    var i = 0
    var l = list.length
    var a1 = args[0]
    var a2 = args[1]
    var a3 = args[2]
    // call is faster than apply, optimize less than 3 argu
    // http://blog.csdn.net/zhengyinhui100/article/details/7837127
    switch (args.length) {
      case 0: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context) !== false && pass} break
      case 1: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context, a1) !== false && pass} break
      case 2: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context, a1, a2) !== false && pass} break
      case 3: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context, a1, a2, a3) !== false && pass} break
      default: for (; i < l; i += 2) {pass = list[i].apply(list[i + 1] || context, args) !== false && pass} break
    }
  }
  // trigger will return false if one of the callbacks return false
  return pass
}
1325912
def _gather_event_handlers(self):
        
        self._extract_event_handlers_from_container(self)
        for module in self.modules:
            self._extract_event_handlers_from_container(module)
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)
54628
def dispatch(self, event, *args):
        

        for callback in self.listeners.get(event, []):
            if len(args) > 0:
                callback(*args)
            else:
                callback()
479146
def _trigger(self, event_name, *args, **kwargs):
        
        self.log('event: %s' % event_name, *args)
        for f in self._events[event_name]:
            f(*args, **kwargs)
51297
function ActionHandler(actionBlock, wait, dontCheckAlerts) {
    this.actionBlock = actionBlock;
    CommandHandler.call(this, "action", true);
    if (wait) {
        this.wait = true;
    }
    // note that dontCheckAlerts could be undefined!!!
    this.checkAlerts = (dontCheckAlerts) ? false : true;
}
738331
def method_missing(method_name, *args, &_block)
      args = args.first if args.size == 1
      @events[method_name] = args
    end
342787
def run_hooks_for(event,*args)
      results = global_hooks_for(event).map { |prc| prc.call(*args) } || [true]
      results << hooks_for(event).map { |method| send(method,*args) }
      results = false if results.any? {|r| false == r }
      results
    end
434497
def __callback(self, event, *args, **kwargs):
        # type: (str, *Any, **Any) -> Any
        
        comp_callback = self.context.get_callback(event)
        if not comp_callback:
            # No registered callback
            return True

        # Call it
        result = comp_callback(self.instance, *args, **kwargs)
        if result is None:
            # Special case, if the call back returns nothing
            return True

        return result
554347
function (event/*, args... */) {
		this._events = this._events || {};
		var e = this._events[event];
		if (e) {
			for (var i = 0, l = e.length; i < l; i++){
				e[i][0].apply(e[i][1] || this, slice(arguments, 1));
			}
		}
	}