18 private static $instance;
19 private static $isJobOn =
false;
21 private $registry = [];
26 private function __construct()
38 self::$instance =
new self();
41 return self::$instance;
48 public static function addEvent($recipients, array $params): void
51 'RECIPIENTS' => $recipients,
73 if (!Main\Loader::includeModule(
'pull'))
81 private function addBackgroundJob(): void
85 $application = Main\Application::getInstance();
86 $application && $application->addBackgroundJob([__CLASS__,
'proceed'], [], 0);
88 self::$isJobOn =
true;
95 private function registerEvent(array $parameters): void
98 'TAG' => $parameters[
'TAG'] ??
'',
99 'RECIPIENTS' => $parameters[
'RECIPIENTS'],
100 'PARAMS' => $parameters[
'PARAMS'],
104 private function sendEvents(): void
106 foreach ($this->registry as $event)
108 if (isset($event[
'TAG']) && $event[
'TAG'] !==
'')
110 \CPullWatch::AddToStack($event[
'TAG'], $event[
'PARAMS']);
114 Event::add($event[
'RECIPIENTS'], $event[
'PARAMS']);