UNPKG

js-uploader

Version:
34 lines 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getStorage = void 0; var tslib_1 = require("tslib"); var IDB_1 = require("./IDB"); var RxIDB = /** @class */ (function (_super) { tslib_1.__extends(RxIDB, _super); function RxIDB(id) { var _this = this; var prefix = id ? RxIDB.dbPrefix + "_" + id : RxIDB.dbPrefix; _this = _super.call(this, prefix + '_public') || this; _this.UploadTask = IDB_1.IDB.createInstance(prefix + '_task'); _this.UploadFile = IDB_1.IDB.createInstance(prefix + '_file'); _this.FileChunk = IDB_1.IDB.createInstance(prefix + '_chunk'); _this.BinaryLike = IDB_1.IDB.createInstance(prefix + '_binary'); return _this; } RxIDB.dbPrefix = 'js-uploader'; return RxIDB; }(IDB_1.IDB)); var storageMap = new Map(); var RxStorage = new RxIDB(); exports.getStorage = function (id) { if (!id) { return RxStorage; } if (storageMap.has(id)) { return storageMap.get(id); } var storage = new RxIDB(id); storageMap.set(id, storage); return storage; }; //# sourceMappingURL=Storage.js.map