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/ui/banner-dispatcher/src/ |
Upload File : |
import { LaunchPriority, type LaunchItemOptions, type LaunchItemCallback } from 'ui.auto-launch'; import { Queue } from './queue'; const criticalQueue = new Queue(LaunchPriority.CRITICAL, 0); const highQueue = new Queue(LaunchPriority.HIGH, 1); const normalQueue = new Queue(LaunchPriority.NORMAL, 1, true); const lowQueue = new Queue(LaunchPriority.LOW, 5, true); export const BannerDispatcher = { critical: { toQueue: (callback: LaunchItemCallback, options: LaunchItemOptions = {}) => { criticalQueue.add(callback, { allowLaunchAfterOthers: true, forceShowOnTop: true, ...options, }); }, }, high: { toQueue: (callback: LaunchItemCallback, options: LaunchItemOptions = {}) => { highQueue.add(callback, { allowLaunchAfterOthers: true, ...options, }); }, }, normal: { toQueue: (callback: LaunchItemCallback, options: LaunchItemOptions = {}) => { normalQueue.add(callback, options); }, }, low: { toQueue: (callback: LaunchItemCallback, options: LaunchItemOptions = {}) => { lowQueue.add(callback, options); }, }, toQueue: (callback: LaunchItemCallback, options: LaunchItemOptions = {}) => { normalQueue.add(callback, options); }, only(priorityList: Array<LaunchPriority>) { const priorityValues = Object.values(LaunchPriority); priorityValues.forEach((priorityValue) => { if (!priorityList.includes(priorityValue)) { switch (priorityValue) { case LaunchPriority.CRITICAL: criticalQueue.stop(); break; case LaunchPriority.HIGH: highQueue.stop(); break; case LaunchPriority.NORMAL: normalQueue.stop(); break; case LaunchPriority.LOW: lowQueue.stop(); break; } } }); }, };