1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.StorageWrapper = exports.MemoryStorage = void 0;
|
4 | class MemoryStorage {
|
5 | constructor() {
|
6 | this.store = {};
|
7 | }
|
8 | getItem(key) {
|
9 | return Promise.resolve(this.store[key]);
|
10 | }
|
11 | setItem(key, value) {
|
12 | return Promise.resolve((this.store[key] = value));
|
13 | }
|
14 | removeItem(key) {
|
15 | const value = this.store[key];
|
16 | delete this.store[key];
|
17 | return Promise.resolve(value);
|
18 | }
|
19 | }
|
20 | exports.MemoryStorage = MemoryStorage;
|
21 | class StorageWrapper {
|
22 | constructor(storage) {
|
23 | this.storage = storage;
|
24 | }
|
25 | getItem(key) {
|
26 | var _a;
|
27 | return Promise.resolve((_a = this.storage) === null || _a === void 0 ? void 0 : _a.getItem(key));
|
28 | }
|
29 | setItem(key, value) {
|
30 | var _a;
|
31 | return Promise.resolve((_a = this.storage) === null || _a === void 0 ? void 0 : _a.setItem(key, value));
|
32 | }
|
33 | removeItem(key) {
|
34 | var _a;
|
35 | return Promise.resolve((_a = this.storage) === null || _a === void 0 ? void 0 : _a.removeItem(key));
|
36 | }
|
37 | }
|
38 | exports.StorageWrapper = StorageWrapper;
|
39 |
|
\ | No newline at end of file |