Returns an array of events to subscribe to and the methods to call when those events are fired
@return array
772882
public static function getSubscribedEvents()
    {
        return [
            Events::UPDATE                                                   => ['onUpdate',0],
            Events::STORE                                                    => ['onStore', 0],
            sprintf('%s.%s', Backend::IDENTIFIER, TransactionEvents::STORED) => ['onTransactionStored', 0]
        ];
    }
864685
private function registerEventListeners()
    {
        $listeners = $this->getListeners();
        foreach ($listeners as $listenerKey => $listenerValues) {
            foreach ($listenerValues as $listenerValue) {
                \Event::listen($listenerKey,
                    $listenerValue
                );
            }
        }
    }
424746
public function initializeEventListeners()
    {
        $configuration = $this->getConfiguration();
        $eventDispatcher = $this->getContainer()->get('event_dispatcher');
        foreach ($configuration->getEventListeners() as $eventName => $listeners) {
            foreach ($listeners as $listener) {
                list($listenerClassName, $listenerMethodName) = explode('::', $listener);

                $listenerInstance = ObjectFactory::getInstance()->newInstance($listenerClassName);
                if ($listenerInstance !== null) {
                    $eventDispatcher->addListener($eventName, array($listenerInstance, $listenerMethodName));
                }
            }
        }

        foreach ($configuration->getEventSubscribers() as $subscriber) {
            $subscriberInstance = ObjectFactory::getInstance()->newInstance($subscriber['class'], $subscriber);
            if ($subscriberInstance instanceof EventSubscriberInterface) {
                $eventDispatcher->addSubscriber($subscriberInstance);
            }
        }
    }
493693
public function events()
    {
        $array = $this->cal;
        $array = isset($array['VEVENT']) ? $array['VEVENT'] : array();
        $events = array();

        if (!empty($array)) {
            foreach ($array as $event) {
                $events[] = new Event($event);
            }
        }

        return $events;
    }
464834
public function dispatch() {
        foreach ($this->_listeners as $key => $listeners) {
            foreach ($this->_events as $events) {
                if (isset($listeners->implementedEvents()[$events->getName()])) {
                    foreach ($listeners->implementedEvents()[$events->getName()] as $event) {
                        if ($events->getStatus() == Event::START && method_exists($listeners, $event)) {
                            ob_start();
                            $this->addError('EVENT call the listener "' . $key . '" "' . get_class($listeners) . '::' . $event . '" for the event "' . $events->getName() . '"', __FILE__, __LINE__, ERROR_INFORMATION);
                            $events->setResult($listeners->$event($events), get_class($listeners) . '::' . $event, get_class($listeners), $event);
                            $output = ob_get_contents();
                            ob_get_clean();

                            $this->addError('[' . $key . '] [' . get_class($listeners) . '::' . $event . '] [' . $events->getName() . "]\n[" . $output . ']', 0, 0, 0, LOG_EVENT);
                        }
                    }
                }
            }
        }
    }
157008
public static function getEventList()
    {
        return array(
            self::EVENT_TYPE_CREATIVEVIEW,
            self::EVENT_TYPE_START,
            self::EVENT_TYPE_FIRSTQUARTILE,
            self::EVENT_TYPE_MIDPOINT,
            self::EVENT_TYPE_THIRDQUARTILE,
            self::EVENT_TYPE_COMPLETE,
            self::EVENT_TYPE_MUTE,
            self::EVENT_TYPE_UNMUTE,
            self::EVENT_TYPE_PAUSE,
            self::EVENT_TYPE_REWIND,
            self::EVENT_TYPE_RESUME,
            self::EVENT_TYPE_FULLSCREEN,
            self::EVENT_TYPE_EXITFULLSCREEN,
            self::EVENT_TYPE_EXPAND,
            self::EVENT_TYPE_COLLAPSE,
            self::EVENT_TYPE_ACCEPTINVITATIONLINEAR,
            self::EVENT_TYPE_CLOSELINEAR,
            self::EVENT_TYPE_SKIP,
            self::EVENT_TYPE_PROGRESS,
        );
    }
323381
function subscribeToEvents() {
    const socket = _socket.get(this);

    function onEventApiError(error) {
        dbg('Event API connection error: ' + JSON.stringify(error));
    }

    socket.on('pong', (latency) => {
        dbg(`Event API latency: ${latency} ms`);
    });
    socket.on('connect_error', onEventApiError);
    socket.on('error', onEventApiError);
    socket.on('disconnect', onEventApiError);
    socket.on('reconnect_error', onEventApiError);
    socket.on('reconnect_failed', () => {
        onEventApiError('Reconnecting to the Event API failed');
    });

    socket.on('new_receipt', receiptJSON => {
        const receipt = Receipt.from(receiptJSON, _provider.get(this));
        _eventEmitter.get(this).emit(EventNames.newReceipt, receipt);
    });
}
1006784
public function add_events()
    {

        // Internal Authentication Events
        $this->app->events->listen(LoginEvent::class, Login::class);
        $this->app->events->listen(LogoutEvent::class, Logout::class);
        $this->app->events->listen(Attempting::class, Attempt::class);

        // Custom Events
        $this->app->events->listen('security.log', SecLog::class);
    }
547447
public function importsEventsIcsAction()
    {
        $form = $this->createForm(new ImportAgendaType());
        $form->handleRequest($this->request);

        if ($form->isValid()) {
            $events = $this->agendaManager->importEvents($form->get('file')->getData());

            return new JsonResponse($events, 200);
        }

        return ['form' => $form->createView()];
    }
591323
public function onRefresh()
    {
        $result = [];
        $saveData = $this->getSaveData();

        /**
         * @event backend.form.beforeRefresh
         * Called before the form is refreshed, modify the $dataHolder->data property in place
         *
         * Example usage:
         *
         *     Event::listen('backend.form.beforeRefresh', function((\Backend\Widgets\Form) $formWidget, (stdClass) $dataHolder) {
         *         $dataHolder->data = $arrayOfSaveDataToReplaceExistingDataWith;
         *     });
         *
         * Or
         *
         *     $formWidget->bindEvent('form.beforeRefresh', function ((stdClass) $dataHolder) {
         *         $dataHolder->data = $arrayOfSaveDataToReplaceExistingDataWith;
         *     });
         *
         */
        $dataHolder = (object) ['data' => $saveData];
        $this->fireSystemEvent('backend.form.beforeRefresh', [$dataHolder]);
        $saveData = $dataHolder->data;

        /*
         * Set the form variables and prepare the widget
         */
        $this->setFormValues($saveData);
        $this->prepareVars();

        /**
         * @event backend.form.refreshFields
         * Called when the form is refreshed, giving the opportunity to modify the form fields
         *
         * Example usage:
         *
         *     Event::listen('backend.form.refreshFields', function((\Backend\Widgets\Form) $formWidget, (array) $allFields) {
         *         $allFields['name']->required = false;
         *     });
         *
         * Or
         *
         *     $formWidget->bindEvent('form.refreshFields', function ((array) $allFields) {
         *         $allFields['name']->required = false;
         *     });
         *
         */
        $this->fireSystemEvent('backend.form.refreshFields', [$this->allFields]);

        /*
         * If an array of fields is supplied, update specified fields individually.
         */
        if (($updateFields = post('fields')) && is_array($updateFields)) {

            foreach ($updateFields as $field) {
                if (!isset($this->allFields[$field])) {
                    continue;
                }

                /** @var FormWidgetBase $fieldObject */
                $fieldObject = $this->allFields[$field];
                $result['#' . $fieldObject->getId('group')] = $this->makePartial('field', ['field' => $fieldObject]);
            }
        }

        /*
         * Update the whole form
         */
        if (empty($result)) {
            $result = ['#'.$this->getId() => $this->makePartial('form')];
        }

        /**
         * @event backend.form.refresh
         * Called after the form is refreshed, should return an array of additional result parameters.
         *
         * Example usage:
         *
         *     Event::listen('backend.form.refresh', function((\Backend\Widgets\Form) $formWidget, (array) $result) {
         *         $result['#my-partial-id' => $formWidget->makePartial('$/path/to/custom/backend/partial.htm')];
         *         return $result;
         *     });
         *
         * Or
         *
         *     $formWidget->bindEvent('form.refresh', function ((array) $result) use ((\Backend\Widgets\Form $formWidget)) {
         *         $result['#my-partial-id' => $formWidget->makePartial('$/path/to/custom/backend/partial.htm')];
         *         return $result;
         *     });
         *
         */
        $eventResults = $this->fireSystemEvent('backend.form.refresh', [$result], false);

        foreach ($eventResults as $eventResult) {
            $result = $eventResult + $result;
        }

        return $result;
    }
327930
protected function listen()
    {
        $events = app('events');
        if (isset($this->listen)) {
            foreach ($this->listen as $event => $listeners) {
                foreach ($listeners as $listener) {
                    $events->listen($event, $listener);
                }
            }
        }
        
        if (isset($this->subscribe)) {
            foreach ($this->subscribe as $subscriber) {
                $events->subscribe($subscriber);
            }
        }
    }
553235
protected function ensureEvents()
	{
		if ($this->_events === null) {
			$this->_events = [];
			if (method_exists($this, 'events')) {
			    if ($events = $this->events()) foreach ($events as $name => $handler) {
					$this->on($name, $handler);
				}
			}
		}
	}
8596
protected static function get_cron_events() {

		$crons  = _get_cron_array();
		$events = array();

		if ( empty( $crons ) ) {
			return new WP_Error(
				'no_events',
				'You currently have no scheduled cron events.'
			);
		}

		foreach ( $crons as $time => $hooks ) {
			foreach ( $hooks as $hook => $hook_events ) {
				foreach ( $hook_events as $sig => $data ) {

					$events[] = (object) array(
						'hook'     => $hook,
						'time'     => $time,
						'sig'      => $sig,
						'args'     => $data['args'],
						'schedule' => $data['schedule'],
						'interval' => Utils\get_flag_value( $data, 'interval' ),
					);

				}
			}
		}

		$events = array_map( 'Cron_Event_Command::format_event', $events );

		return $events;

	}
505386
public function actionEvents() {

		$user = Yii::$app->user->GetIdentity();

		$startDate	= Yii::$app->request->post( 'startDate' );
		$endDate	= Yii::$app->request->post( 'endDate' );

		$events = $this->modelService->getByRangeUserId( $startDate, $endDate, $user->id );
		$data	= [];

		foreach( $events as $event ) {

			$data[] = [ 'id' => $event->id, 'title' => "$event->name - $event->description", 'start' => $event->scheduledAt ];
		}

		// Trigger Ajax Success
		return AjaxUtil::generateSuccess( Yii::$app->coreMessage->getMessage( CoreGlobal::MESSAGE_REQUEST ), $data );
	}
251298
protected function bindEvents()
    {
        if(!$this->isSubServer)
        {
            $this->swooleServer->on('start', function(\swoole_server $server){
                try{
                    Event::trigger('IMI.MAIN_SERVER.START', [
                        'server' => $this,
                    ], $this, StartEventParam::class);
                }
                catch(\Throwable $ex)
                {
                    App::getBean('ErrorLog')->onException($ex);
                }
            });
    
            $this->swooleServer->on('shutdown', function(\swoole_server $server){
                try{
                    Event::trigger('IMI.MAIN_SERVER.SHUTDOWN', [
                        'server' => $this,
                    ], $this, ShutdownEventParam::class);
                }
                catch(\Throwable $ex)
                {
                    App::getBean('ErrorLog')->onException($ex);
                }
            });
    
            $this->swooleServer->on('WorkerStart', function(\swoole_server $server, int $workerID){
                try{
                    Event::trigger('IMI.MAIN_SERVER.WORKER.START', [
                        'server'    => $this,
                        'workerID'  => $workerID,
                    ], $this, WorkerStartEventParam::class);
                }
                catch(\Throwable $ex)
                {
                    App::getBean('ErrorLog')->onException($ex);
                }
            });
    
            $this->swooleServer->on('WorkerStop', function(\swoole_server $server, int $workerID){
                try{
                    Event::trigger('IMI.MAIN_SERVER.WORKER.STOP', [
                        'server'    => $this,
                        'workerID'  => $workerID,
                    ], $this, WorkerStopEventParam::class);
                }
                catch(\Throwable $ex)
                {
                    App::getBean('ErrorLog')->onException($ex);
                }
            });
    
            $this->swooleServer->on('ManagerStart', function(\swoole_server $server){
                try{
                    Event::trigger('IMI.MAIN_SERVER.MANAGER.START', [
                        'server' => $this,
                    ], $this, ManagerStartEventParam::class);
                }
                catch(\Throwable $ex)
                {
                    App::getBean('ErrorLog')->onException($ex);
                }
            });
    
            $this->swooleServer->on('ManagerStop', function(\swoole_server $server){
                try{
                    Event::trigger('IMI.MAIN_SERVER.MANAGER.STOP', [
                        'server' => $this,
                    ], $this, ManagerStopEventParam::class);
                }
                catch(\Throwable $ex)
                {
                    App::getBean('ErrorLog')->onException($ex);
                }
            });
    
            $this->swooleServer->on('task', function(\swoole_server $server, int $taskID, int $workerID, $data){
                try{
                    Event::trigger('IMI.MAIN_SERVER.TASK', [
                        'server'    => $this,
                        'taskID'    => $taskID,
                        'workerID'  => $workerID,
                        'data'      => $data,
                    ], $this, TaskEventParam::class);
                }
                catch(\Throwable $ex)
                {
                    App::getBean('ErrorLog')->onException($ex);
                }
            });
    
            $this->swooleServer->on('finish', function(\swoole_server $server, int $taskID, $data){
                try{
                    Event::trigger('IMI.MAIN_SERVER.FINISH', [
                        'server'    => $this,
                        'taskID'    => $taskID,
                        'data'      => $data,
                    ], $this, FinishEventParam::class);
                }
                catch(\Throwable $ex)
                {
                    App::getBean('ErrorLog')->onException($ex);
                }
            });
    
            $this->swooleServer->on('PipeMessage', function(\swoole_server $server, int $workerID, $message){
                try{
                    Event::trigger('IMI.MAIN_SERVER.PIPE_MESSAGE', [
                        'server'    => $this,
                        'workerID'  => $workerID,
                        'message'   => $message,
                    ], $this, PipeMessageEventParam::class);
                }
                catch(\Throwable $ex)
                {
                    App::getBean('ErrorLog')->onException($ex);
                }
            });

            $this->swooleServer->on('WorkerError', function(\swoole_server $server, int $workerID, int $workerPid, int $exitCode, int $signal){
                try{
                    Event::trigger('IMI.MAIN_SERVER.WORKER_ERROR', [
                        'server'    => $this,
                        'workerID'  => $workerID,
                        'workerPid' => $workerPid,
                        'exitCode'  => $exitCode,
                        'signal'    => $signal,
                    ], $this, WorkerErrorEventParam::class);
                }
                catch(\Throwable $ex)
                {
                    App::getBean('ErrorLog')->onException($ex);
                }
            });
        }
        $this->__bindEvents();
    }
1312234
public function events()
    {
        return [
            Server::ON_CONNECT => 'onConnect',
            Server::ON_MESSAGE => 'onMessage',
            Server::ON_CLOSE => 'onClose',
            Server::ON_ERROR => 'onError',
            Server::ON_BAD_PACKET => 'onBadPacket',
            Server::ON_BUFFER_FULL => 'onBufferFull',
            Server::ON_BUFFER_DRAIN => 'onBufferDrain',
            Server::ON_SSL_HANDSHAKED => 'onSSLHandShaked',
            Server::ON_UDP_PACKET => 'onUdpPacket',
            Server::ON_START_ACCEPT => 'onStartAccept',
            Server::ON_STOP_ACCEPT => 'onStopAccept',
        ];
    }
228946
public static function getSubscribedEvents()
    {
        return array(
            NodeEvents::NODE_CHANGE_STATUS => 'updateRouteDocument',
            RedirectionEvents::REDIRECTION_CREATE => 'createOrUpdateForRedirection',
            RedirectionEvents::REDIRECTION_UPDATE => 'createOrUpdateForRedirection',
            RedirectionEvents::REDIRECTION_DELETE => 'deleteForRedirection',
            SiteEvents::SITE_UPDATE => 'updateRouteDocumentOnSiteUpdate',
            SiteEvents::SITE_DELETE => 'deleteRouteDocumentOnSiteDelete',
        );
    }