Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/im/application/launch/src/ |
Upload File : |
/** * Bitrix Im * Application Launcher * * @package bitrix * @subpackage im * @copyright 2001-2020 Bitrix */ import {Logger} from "im.lib.logger"; const ApplicationLauncher = function (app, params = {}) { let application = ''; let name = ''; if (typeof app === 'object') { name = app.name.toString(); application = app.application.toString(); } else { name = app.toString(); application = app; } application = application.substr(0, 1).toUpperCase()+application.substr(1); if (application === 'Launch' || application === 'Core' || application.endsWith('Application')) { Logger.error('BX.Messenger.Application.Launch: specified name is forbidden.'); return new Promise((resolve, reject) => reject()); } let launch = function() { try { BX.Messenger.Application[name] = new BX.Messenger.Application[application+'Application'](params); return BX.Messenger.Application[name].ready(); } catch (e) { Logger.error(`BX.Messenger.Application.Launch: application "${application}" is not initialized.`); return false; } }; if ( typeof BX.Messenger.Application[application+'Application'] === 'undefined' && typeof BX.Runtime !== 'undefined' && typeof BX.Runtime.loadExtension !== 'undefined' ) { let loadExtension = 'im.application.'+application.toString().toLowerCase(); return BX.Runtime.loadExtension(loadExtension).then(() => launch()); } return launch(); }; export {ApplicationLauncher as Launch};