Fire an event named ``name`` with each item in iterable
767146
def iterable_hook(self, name, iterable):
        
        for record in iterable:
            self(name, record)
            yield record
924272
function iterator(since) {
    if (stop) {
      return;
    }

    var attr = [];
    attr.push({ key: 'since', val: since });
    attr.push({ key: 'events', val: events });

    req({ method: 'events', endpoint: false, attr: attr }).then(function (eventArr) {

      //Check for event count on first request iteration
      if (since != 0) {
        eventArr.forEach(function (e) {
          _this.emit(lowerCaseFirst(e.type), e.data);
        });
      }

      //Update event count
      if (eventArr.length > 0) {
        since = eventArr[eventArr.length - 1].id;
      }

      //Reset tries
      tries = 0;

      setTimeout(function () {
        return iterator(since);
      }, 100);
    }).catch(function (err) {
      _this.emit('error', err);

      //Try to regain connection & reset event counter
      if (tries < retries) {
        tries++;
        setTimeout(function () {
          return iterator(0);
        }, 500);
      }
    });
  }
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))
459139
function trigger (state, eventName) {
  var args = [].slice.call(arguments, 1)

  state.emitter.emit.apply(state.emitter, args)

  return this
}
1340759
function(view){
    var prefix = Marionette.getOption(this, "itemViewEventPrefix");

    // Forward all child item view events through the parent,
    // prepending "itemview:" to the event name
    this.listenTo(view, "all", function(){
      var args = slice(arguments);
      args[0] = prefix + ":" + args[0];
      args.splice(1, 0, view);

      Marionette.triggerMethod.apply(this, args);
    }, this);
  }
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)
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)
1309440
function emit(name, args, thisArg, delay) {
        var list = eventHandlers[name];
        if ( list ) {
            thisArg || (thisArg = this);
            if ( args ) {
                args = args.slice(); // make a copy
                args.unshift(name);
            }
            else {
                args = [name];
            }
            _.each(list, function (hdl, idx) {
                // var _args = args.slice();
                delay > -1
                    ? setTimeout(function () {
                        hdl.apply(thisArg, args);
                      }, delay)
                    : hdl.apply(thisArg, args)
                ;
            });
        }
        return this;
    }
211774
function(obj, name, sentinel, args) {
  if (obj._events) {
    // If `sentinel` is not the trigger sentinel, trigger was called
    // with a `{event: value}` object, and it is `value`.
    if (sentinel !== triggerSentinel) args = [sentinel].concat(args);

    var events = obj._events[name];
    var allEvents = obj._events.all;
    if (events) triggerEvents(events, args);
    if (allEvents) triggerEvents(allEvents, [name].concat(args));
  }
  return obj;
}
513183
function fire(name, args) {
            ngAlertsEvent.fire(name, args);
            ngAlertsEvent.fire('change', args);
        }
1125263
function iterateEvents(target, entity, bindings, functionCallback, stringCallback){
    if (!entity || !bindings) { return; }

    // allow the bindings to be a function
    if (_.isFunction(bindings)){
      bindings = bindings.call(target);
    }

    // iterate the bindings and bind them
    _.each(bindings, function(methods, evt){

      // allow for a function as the handler, 
      // or a list of event names as a string
      if (_.isFunction(methods)){
        functionCallback(target, entity, evt, methods);
      } else {
        stringCallback(target, entity, evt, methods);
      }

    });
  }
979395
def events(self, **kwargs):
        
        events_result = self.service.events().list(**kwargs).execute()
        return [Event(event) for event in events_result.get("items", [])]
1088464
function onEvent(e) {
    const eventData = e.detail;

    if (ignoreFiredEvents === true) {
      return;
    }

    fireEvent(e.currentTarget, eventData);
  }
1139639
def trigger_events(events, loop):
    
    for event in events:
        result = event(loop)
        if isawaitable(result):
            loop.run_until_complete(result)
661570
def fire_event(self, event, *args, **kwargs):
        
        remove = []
        event_stack = self._events[event]
        for x in event_stack:
            x['callback'](*args, **kwargs)
            if x['single']:
                remove.append(x)
        for x in remove:
            event_stack.remove(x)
867568
def call(self, name: str, *args, **kwargs):
        ''''''
        if self._event_dispatcher is not None:
            self._event_dispatcher.notify(name, *args, **kwargs)

        if self._callbacks[name]:
            return self._callbacks[name](*args, **kwargs)
        else:
            raise HookDisconnected('No callback is connected.')
1030531
function fireEvent (element, type, data) {
  const evt = document.createEvent('Event')
  evt.data = data
  for (const k in data) {
    if (data.hasOwnProperty(k)) {
      evt[k] = data[k]
    }
  }
  // need bubble.
  evt.initEvent(type, true, true)

  element.dispatchEvent(evt)
}