Your IP : 18.191.216.208


Current Path : /var/www/admin_ftp_12/data/www/httpdocs/bitrix/modules/ui/lib/NotificationManager/
Upload File :
Current File : /var/www/admin_ftp_12/data/www/httpdocs/bitrix/modules/ui/lib/NotificationManager/Notifier.php

<?php

namespace Bitrix\UI\NotificationManager;

use Bitrix\Main\Loader;
use Bitrix\Pull\Event;

class Notifier
{
	/**
	 * Sends a notification to the user
	 *
	 * @param int $userId
	 * @param Notification $notification
	 *
	 * @return bool
	 * @throws \Bitrix\Main\LoaderException
	 */
	public static function notify(int $userId, Notification $notification): bool
	{
		if (!Loader::includeModule('pull'))
		{
			return false;
		}

		return Event::add($userId, [
			'module_id' => 'ui',
			'command' => 'notify',
			'params' => [
				'notification' => $notification,
			],
		]);
	}
}