Called by the native application when events are sent to JS from the app. Will execute every function, FIFO order, that was attached to this event type.
322216
function(type, messageId, json) {
            var self = this;

            var listenerList = this.listeners[type] || [];

            var executedCount = 0;

            var complete = function() {
                executedCount += 1;

                if (executedCount >= listenerList.length) {
                    self.dispatcher.sendCallback(messageId);
                }
            };

            for (var index = 0; index < listenerList.length; index++) {
                var listener = listenerList[index];

                // If it's a "sync" listener, we'll call the complete() function
                // after it has finished. If it's async, we expect it to call complete().
                if (listener.length <= 1) {
                    listener(json);
                    complete();
                } else {
                    listener(json, complete);
                }
            }

        }
62114
def on_event(self, event):
        
        self._queue.append((event))
        if not self._active and self.plot.document:
            self.plot.document.add_timeout_callback(self.process_on_event, 50)
            self._active = True
576686
def trigger_event(self, event, client, args, force_dispatch=False):
        """"""
        self.controller.process_event(event, client, args, force_dispatch=force_dispatch)
527458
function executeEventHandlersSerially(hook, opts) {
    var handlers = events.listeners(hook);
    if (handlers.length) {
        // Chain the handlers in series.
        return handlers.reduce(function(soFar, f) {
            return soFar.then(function() { return f(opts); });
        }, Q());
    } else {
        return Q(); // Nothing to do.
    }
}
643114
function handleEvent(dom, handler, e) {
  var ptag = this.__.parent,
    item = this.__.item;

  if (!item)
    { while (ptag && !item) {
      item = ptag.__.item;
      ptag = ptag.__.parent;
    } }

  // override the event properties
  /* istanbul ignore next */
  if (isWritable(e, 'currentTarget')) { e.currentTarget = dom; }
  /* istanbul ignore next */
  if (isWritable(e, 'target')) { e.target = e.srcElement; }
  /* istanbul ignore next */
  if (isWritable(e, 'which')) { e.which = e.charCode || e.keyCode; }

  e.item = item;

  handler.call(this, e);

  // avoid auto updates
  if (!settings$1.autoUpdate) { return }

  if (!e.preventUpdate) {
    var p = getImmediateCustomParentTag(this);
    // fixes #2083
    if (p.isMounted) { p.update(); }
  }
}
444452
function (done) {
        var self = this;

        async.waterfall([

          function (next) {
            _.delay(next, 15000);
          },
          function (next) {
            self.events.find({
              monologued: false,
              recorded_at: {
                $lte: new Date(Date.now() - 15000)
              }
            }).sort({
              created_at: 1
            }).exec(next);
          },
          function (items, next) {
            _.each(items, function (item) {
              /**
               * Events captured from an event stream during long-polling.
               * The event name is of the form polling.event.EVENT, where EVENT is the lowercased,
               * (_ -> .)-transformed version of the source event type. This transformation helps
               * leverage {@link external:Monologue|Monologue} subscription filters.
               * @typedef {string} PollingEvent
               * @see {@link https://developers.box.com/docs/#events}
               * @example
               * When an event of type {@linkcode ITEM_CREATE} is read from the event stream,
               * an event {@linkcode polling.event.item.create} is emitted.
               */

              /**
               * Fires when an event is read from the event stream during long-polling.
               * @event Connection#"polling.event.EVENT"
               * @type {PollingEvent}
               */
              self.emit('polling.event.' + item.event_type.toLowerCase().replace('_', '.'),
                _.omit(item, 'monologued', '_id'));
            });

            self.events.update({
              event_id: {
                $in: _.pluck(items, 'event_id')
              }
            }, {
              $set: {
                monologued: true
              }
            }, {
              multi: true
            }, next);
          }
        ], done);
      }
1091512
def _on_io_events(self, fd=None, _events=None):
        
        if fd not in self._connections:
            LOGGER.warning('Received IO event for non-existing connection')
            return
        self._poll_connection(fd)
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)
}
47789
function (event) {
            var
                eventsHandler;
            if (event
                && event.type() === _gpfI.IWritableStream.EVENT_ERROR) {
                gpfFireEvent.call(this, event, this._eventsHandler);
            } else if (0 === this._buffer.length) {
                eventsHandler = this._eventsHandler;
                this._eventsHandler = null;
                gpfFireEvent.call(this, _gpfI.IWritableStream.EVENT_READY, eventsHandler);
            } else {
                this._stream.write(this._buffer.shift(), this._flushed.bind(this));
            }
        }
673656
function(event, fn, selector, context) {	
	return localnwt.event.on(this, event, fn, selector,context);
}
323078
function( type, handler ) {

      if( handler === void 0 || handler === null )
        throw new Error( 'Missing argument "handler"' )

      if( typeof handler !== 'function' && typeof handler.handleEvent !== 'function' )
        throw new TypeError( 'Handler must be a function.' )

      this._events[ type ] ?
        this._events[ type ].push( handler ) :
        this._events[ type ] = [ handler ]

      if( Emitter.warn && this._events[ type ].length > this._maxListeners ) {
        if( this._maxListeners > 0 && !this._memLeakDetected ) {
          this._memLeakDetected = true
          console.warn(
            'WARNING: Possible event emitter memory leak detected.',
            this._events[ type ].length, 'event handlers added.',
            'Use emitter.setMaxListeners() to increase the threshold.'
          )
          console.trace()
        }
      }

      return this

    }
385106
function(events) {
    var self = this;
    events.forEach(function(event) {
      self.undispatchedEventsQueue.push(event);
    });
    trigger(this);
  }
1198958
function (type, handler) {

            // Validate arguments
            if (typeof type !== 'string') {
                throw new Error('Type must be a string');
            }
            if (typeof handler !== 'function') {
                throw new Error('Handler must be a function');
            }

            // Check for presence of event store
            if (!this._events) {
                this._events = {};
            }
            if (!this._events[type]) {
                this._events[type] = [];
            }

            // Add handler
            this._events[type].push(handler);

        }
106304
function(event, fn) {
        if (!this._callbacks[event]) {
            return;
        }
        var callbacks = this._callbacks[event];
        // Iterate through and delete the callback functions that match
        // They are spliced out when _runCallbacks is invoked, not here
        // (This function might be called in the middle of a callback, which complicates the logic)
        for (var i = 0; i < callbacks.length; i++) {
            if (!fn || callbacks[i] === fn) {
                delete callbacks[i];
            }
        }
    }
749914
def js_on_click(self, handler):
        '''  '''
        self.js_on_event(ButtonClick, handler)
        self.js_on_event(MenuItemClick, handler)
190038
function on(event, fn) {
		if (typeof event !== 'string') {
			throw new Error('"event" not a string');
		}
		if (!(fn instanceof Function)) {
			throw new Error('"fn" not a Function');
		}

		if (hasListener(event, fn)) {
			return false;
		}

		if (!hasListeners(event)) {
			listeners[event] = [];
		}
		listeners[event].push(fn);

		return true;
	}
383376
public function handleReadEvent()
    {
        $messages = $this->socket->recvmulti(ZMQ::MODE_DONTWAIT);
        if (false !== $messages)
        {
            $this->emit('messages', [ $messages ]);
        }
    }