js-uploader
Version:
A JavaScript library for file upload
31 lines • 1.02 kB
JavaScript
import { __extends } from "tslib";
import { IDB } from './IDB';
var RxIDB = /** @class */ (function (_super) {
__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.createInstance(prefix + '_task');
_this.UploadFile = IDB.createInstance(prefix + '_file');
_this.FileChunk = IDB.createInstance(prefix + '_chunk');
_this.BinaryLike = IDB.createInstance(prefix + '_binary');
return _this;
}
RxIDB.dbPrefix = 'js-uploader';
return RxIDB;
}(IDB));
var storageMap = new Map();
var RxStorage = new RxIDB();
export var 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