Registers the dispatcherEvents hash
429908
function () {
    // Allow using a function or an object
    var events = _.result(this, 'dispatcherEvents');

    if (_.isUndefined(events) || _.isEmpty(events)) {
      // Bug out early if no dispatcherEvents
      return;
    }

    var registrations = {};
    _.each(events, function (funcOrName, actionType) {
      // Quick sanity check for whether there is a problem with the function/name passed
      if (!(_.isFunction(funcOrName) || _.isFunction(this[funcOrName]))) {
        console.warn('dispatcherEvent: "' + funcOrName + '" is not a function');
        return;
      }

      if (_.isFunction(funcOrName)) {
        registrations[actionType] = funcOrName;
      } else {
        registrations[actionType] = this[funcOrName];
      }

    }.bind(this));

    this.dispatcherToken = dispatcher.register(registrations, this);
  }
925284
def dispatch(self, event):
        

        for event_types, queues in self.queues.items():
            if event.type & event_types:
                for queue in queues:
                    queue.put(event)
880462
private String registerEventHandler(GFXEventHandler h) {
        //checkInitialized();
        if (!registeredOnJS) {
            JSObject doc = (JSObject) runtime.execute("document");
            doc.setMember("jsHandlers", jsHandlers);
            registeredOnJS = true;
        }
        return jsHandlers.registerHandler(h);
    }
234149
protected function registerEventSignals()
    {
        if (!EventLoop::$instance) {
            return;
        }
        foreach (self::$signals as $no => $name) {
            if ($name === 'SIGKILL' || $name == 'SIGSTOP') {
                continue;
            }

            $ev = EventLoop::$instance->signal($no, [$this, 'eventSighandler'], [$no]);
            if (!$ev) {
                $this->log('Cannot event_set for ' . $name . ' signal');
            }
            $ev->add();
            $this->sigEvents[$no] = $ev;
        }
    }
52396
function dispatch(context, event, args) {
    var date = new Date()
    for (var i = 0; i < listeners.length; i++)
      listeners[i](context, event, date, args)
  }
1217405
function Dispatcher(emitter, events) {
  if (!(this instanceof Dispatcher)) return new Dispatcher(emitter, events);

  assert(emitter instanceof EventEmitter, 'simple-dispatcher: emitter should be an EventEmitter');
  assert('object' == typeof events, 'simple-dispatcher: events should be an object');

  // iterate over keys in event
  // and map the cb values to the emitter.

  Object.keys(events).forEach(function(key) {
    var arr = Array.isArray(events[key]) ? events[key] : [events[key]];
    arr.forEach(function(cb) {
      emitter.on(key, cb);
    });
  });
}
643734
protected function registerEventRebindHandler()
    {
        $this->app->rebinding('events', function ($app, $dispatcher) {
            if (! $app->resolved('auth')) {
                return;
            }

            if (method_exists($guard = $app['auth']->guard(), 'setDispatcher')) {
                $guard->setDispatcher($dispatcher);
            }
        });
    }
72220
function registerCurrentItemEvents (params) {
          // Destructuring:
          var item = params.item;
          var $ul = params.$ul;
          var $li = params.$li;
          var $scope = params.$scope;
          var modelValue = params.modelValue;
          var level = params.level;
          var event = params.event;
          var text = params.text;
          var nestedMenu = params.nestedMenu;
          var enabled = params.enabled;
          var orientation = String(params.orientation).toLowerCase();
          var customClass = params.customClass;

          if (enabled) {
            var openNestedMenu = function ($event) {
              removeContextMenus(level + 1);
              /*
               * The object here needs to be constructed and filled with data
               * on an "as needed" basis. Copying the data from event directly
               * or cloning the event results in unpredictable behavior.
               */
              /// adding the original event in the object to use the attributes of the mouse over event in the promises
              var ev = {
                pageX: orientation === 'left' ? event.pageX - $ul[0].offsetWidth + 1 : event.pageX + $ul[0].offsetWidth - 1,
                pageY: $ul[0].offsetTop + $li[0].offsetTop - 3,
                // eslint-disable-next-line angular/window-service
                view: event.view || window,
                target: event.target,
                event: $event
              };

              /*
               * At this point, nestedMenu can only either be an Array or a promise.
               * Regardless, passing them to `when` makes the implementation singular.
               */
              $q.when(nestedMenu).then(function(promisedNestedMenu) {
                if (angular.isFunction(promisedNestedMenu)) {
                  //  support for dynamic subitems
                  promisedNestedMenu = promisedNestedMenu.call($scope, $scope, event, modelValue, text, $li);
                }
                var nestedParam = {
                  $scope : $scope,
                  event : ev,
                  options : promisedNestedMenu,
                  modelValue : modelValue,
                  level : level + 1,
                  orientation: orientation,
                  customClass: customClass
                };
                renderContextMenu(nestedParam);
              });
            };

            $li.on('click', function ($event) {
              if($event.which == 1) {
                $event.preventDefault();
                $scope.$apply(function () {

                  var cleanupFunction = function () {
                    $(event.currentTarget).removeClass('context');
                    removeAllContextMenus();
                  };
                  var clickFunction = angular.isFunction(item.click)
                    ? item.click
                    : (angular.isFunction(item[1])
                      ? item[1]
                      : null);

                  if (clickFunction) {
                    var res = clickFunction.call($scope, $scope, event, modelValue, text, $li);
                    if(res === undefined || res) {
                      cleanupFunction();
                    }
                  } else {
                    cleanupFunction();
                  }
                });
              }
            });

            $li.on('mouseover', function ($event) {
              $scope.$apply(function () {
                if (nestedMenu) {
                  openNestedMenu($event);
                } else {
                  removeContextMenus(level + 1);
                }
              });
            });
          } else {
            setElementDisabled($li);
          }
        }
418706
def register(self, name: str):
        ''''''
        if name in self._callbacks:
            raise ValueError('Hook already registered')

        self._callbacks[name] = None

        if self._event_dispatcher is not None:
            self._event_dispatcher.register(name)
987843
def dispatch_events!
      loop do
        event = @event_queue.pop

        callbacks.each do |callback|
          Thread.new do
            callback.call event
          end
        end
      end
    end
1335308
private function registerListeners(): void
    {
        Event::listen(ReactionHasBeenAdded::class, IncrementAggregates::class);
        Event::listen(ReactionHasBeenRemoved::class, DecrementAggregates::class);
    }
526499
def dispatchEvent(self, event, *args):
        
        for callback in self.listeners[event]:
            yield callback(event, self, *args)
278794
protected function registerFinishCallback()
    {
        $this->swooleServer->on('Finish', function ($server, $taskId, $data) {
            $this->events->dispatch(new Events\TaskFinished($this, $taskId, $data));

            $this->dispatchEvent('Finish', $this, $taskId, $data);
        });
    }
687074
def register_handler(queues, opts={}, handler=nil, &block) #:nodoc:
      Array(queues).each do |queue|
        @handlers[queue] = [opts.symbolize_keys, handler || block]
      end
    end
245507
protected function registerRequestCallback()
    {
        $this->swoolePort->on('Request', function ($request, $response) {
            $this->dispatchEvent('Request', $this->server, $this, $request, $response);
        });
    }
1173221
function registerModuleEventListener (name, module, meta) {
  if (name !== 'globalEvent') {
    module['addEventListener'] = function (evt, callbackId, options) {
      return addEventListener.call(this, name, evt, callbackId, options)
    }
    module['removeAllEventListeners'] = function (evt) {
      return removeAllEventListeners.call(this, name, evt)
    }
    ; [{
      name: 'addEventListener',
      args: ['string', 'function', 'object']
    }, {
      name: 'removeAllEventListeners',
      args: ['string']
    }].forEach(info => meta[name].push(info))
  }
}
1041654
public function dispatch() {
		$params = func_get_args();
		$event = array_shift($params);
		if (strpos('::', $event) === false) {
			$classname = get_called_class();
			$method = $event;
		} else {
			list($classname, $method) = explode('::', $event);
		}
		$event_name = strtolower(str_replace('\\', '_', $classname . '_' . $method));

		$dispatcher = \Skeleton\Event\Dispatcher::get();
		if ($dispatcher->has_listener($event_name) === false) {
			$this->add_listener($event);
		}

		$dispatcher->dispatch($event_name, $params);
	}