Register the event callback.
513997
protected function registerHandShakeCallback()
    {
        $this->swoolePort->on('HandShake', function ($request, $response) {
            $this->dispatchEvent('HandShake', $this->server, $this, $request, $response);
        });
    }
576032
def register_event(self, event_name, event_level, message):
        
        self.events[event_name] = (event_level, message)
1188662
function registerEventListener(eventList, callback) {
        for (var x = 0; x < eventList.length; x++) {
            if (POINTER_MOVE.indexOf(eventList[x]) === -1) {
                me.input.pointerEventTarget.addEventListener(eventList[x], callback, { passive: (api.preventDefault === false) });
            }
        }
    }
386515
protected function registerShutdownCallback()
    {
        $this->swooleServer->on('Shutdown', function () {
            $this->events->dispatch(new Events\ServerShutdown($this));

            $this->dispatchEvent('Shutdown', $this);
        });
    }
1130067
public function registerEvents()
    {
        $job = & $this->job;

        Event::listen(Event::JOB_PERFORM, function ($event, $_job) use (&$job) {
            $job = $_job;
        });
    }
1117863
public function registerCallback( $event, $callback ) {

		if ( !is_string( $event ) ) {
			throw new InvalidArgumentException( "Event is not a string" );
		}

		if ( !is_callable( $callback ) ) {
			throw new RuntimeException( "Invoked object is not a valid callback or Closure" );
		}

		$this->addToCollection( $event, new GenericCallbackEventListener( $callback ) );
	}
1158917
public function register()
  {
    $events = $this->register;

    foreach($events as $name => $event) {
      Events::listen($name, $event);
    }
  }
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);
            }
        });
    }
975539
public static function register()
	{
		$class = new self();
		Events::addListener(array($class, 'screenLogEventListener'), 'screenLogEvent', EventPriority::NORMAL);
		$bar = Debugger::getBar();
		$bar->addPanel($class);
	}
536402
protected function registerPipeMessageCallback()
    {
        $this->swooleServer->on('PipeMessage', function ($server, $srcWorkerId, $data) {
            $this->events->dispatch(new Events\PipeMessageReceived($this, $srcWorkerId, $data));

            $this->dispatchEvent('PipeMessage', $this, $srcWorkerId, $data);
        });
    }
864685
private function registerEventListeners()
    {
        $listeners = $this->getListeners();
        foreach ($listeners as $listenerKey => $listenerValues) {
            foreach ($listenerValues as $listenerValue) {
                \Event::listen($listenerKey,
                    $listenerValue
                );
            }
        }
    }
278341
def bind(self, event_name, callback, *args, **kwargs):
        
        self.event_callbacks[event_name].append((callback, args, kwargs))
567852
protected function registerClientEvents() {
		if (!empty($this->clientEvents)) {
			$id = $this->options['id'];
			$js = [];
			foreach ($this->clientEvents as $event => $handler) {
				$js[] = "jQuery('#$id').on('$event', $handler);";
			}
			$this->view->registerJs(implode("\n", $js));
		}
	}
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);
        });
    }
131211
protected function registerEvent($name, Closure $callback)
    {
        if (! isset(static::$dispatcher)) {
            $this->initEventDispatcher();
        }

        static::$dispatcher->listen($name, $callback);
    }
1374475
private function registerEvents()
    {
        foreach ($this->getSetting('events', []) as $event => $listeners) {
            foreach ($listeners as $listener) {
                Event::bind($event, $listener);
            }
        }
    }
1137305
protected function registerTaskCallback()
    {
        $this->swooleServer->on('Task', function ($server, $taskId, $srcWorkerId, $data) {
            $this->events->dispatch(new Events\TaskTriggered($this, $taskId, $srcWorkerId, $data));

            $this->dispatchEvent('Task', $this, $taskId, $srcWorkerId, $data);
        });
    }