@esportsplus/web-storage 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +1 -1
- package/build/local/index.d.ts +3 -3
- package/build/local/index.js +4 -4
- package/build/local/types.d.ts +4 -1
- package/package.json +1 -1
- package/src/local/index.ts +5 -6
- package/src/local/types.ts +3 -1
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import local from './local';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
local: {
|
|
4
|
-
store: (options
|
|
4
|
+
store: (options: import("./local/types").Options) => {
|
|
5
5
|
instance: LocalForage;
|
|
6
6
|
iterate: <T, U>(iteratee: (value: T, key: string, iterationNumber: number) => U, callback?: ((err: any, result: U) => void) | undefined) => Promise<U>;
|
|
7
7
|
keys: (callback?: ((err: any, keys: string[]) => void) | undefined) => Promise<string[]>;
|
package/build/local/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Object } from './types';
|
|
1
|
+
import { Object, Options } from './types';
|
|
2
2
|
declare class Store {
|
|
3
3
|
instance: LocalForage;
|
|
4
4
|
iterate: LocalForage['iterate'];
|
|
5
5
|
keys: LocalForage['keys'];
|
|
6
6
|
length: LocalForage['length'];
|
|
7
|
-
constructor(options
|
|
7
|
+
constructor(options: Options);
|
|
8
8
|
all(): Promise<Object>;
|
|
9
9
|
clear(): Promise<void>;
|
|
10
10
|
delete(...keys: string[]): Promise<void>;
|
|
@@ -16,6 +16,6 @@ declare class Store {
|
|
|
16
16
|
}): Promise<void>;
|
|
17
17
|
}
|
|
18
18
|
declare const _default: {
|
|
19
|
-
store: (options
|
|
19
|
+
store: (options: Options) => Store;
|
|
20
20
|
};
|
|
21
21
|
export default _default;
|
package/build/local/index.js
CHANGED
|
@@ -10,8 +10,8 @@ class Store {
|
|
|
10
10
|
iterate;
|
|
11
11
|
keys;
|
|
12
12
|
length;
|
|
13
|
-
constructor(options
|
|
14
|
-
let driver
|
|
13
|
+
constructor(options) {
|
|
14
|
+
let driver;
|
|
15
15
|
switch ((options.driver || types_1.Driver.IndexedDB)) {
|
|
16
16
|
case types_1.Driver.LocalStorage:
|
|
17
17
|
driver = localforage_1.default.LOCALSTORAGE;
|
|
@@ -20,7 +20,7 @@ class Store {
|
|
|
20
20
|
driver = localforage_1.default.INDEXEDDB;
|
|
21
21
|
break;
|
|
22
22
|
}
|
|
23
|
-
this.instance = localforage_1.default.createInstance(Object.assign(options, { driver,
|
|
23
|
+
this.instance = localforage_1.default.createInstance(Object.assign(options, { driver, storeName: options.name }));
|
|
24
24
|
this.iterate = this.instance.iterate;
|
|
25
25
|
this.keys = this.instance.keys;
|
|
26
26
|
this.length = this.instance.length;
|
|
@@ -83,5 +83,5 @@ class Store {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
exports.default = {
|
|
86
|
-
store: (options
|
|
86
|
+
store: (options) => new Store(options)
|
|
87
87
|
};
|
package/build/local/types.d.ts
CHANGED
package/package.json
CHANGED
package/src/local/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Driver, Object } from './types';
|
|
1
|
+
import { Driver, Object, Options } from './types';
|
|
2
2
|
import localforage from 'localforage';
|
|
3
3
|
|
|
4
4
|
|
|
@@ -9,9 +9,8 @@ class Store {
|
|
|
9
9
|
length: LocalForage['length'];
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
constructor(options:
|
|
13
|
-
let driver
|
|
14
|
-
name = options.name || 'store';
|
|
12
|
+
constructor(options: Options) {
|
|
13
|
+
let driver;
|
|
15
14
|
|
|
16
15
|
switch ((options.driver || Driver.IndexedDB) as Driver) {
|
|
17
16
|
case Driver.LocalStorage:
|
|
@@ -23,7 +22,7 @@ class Store {
|
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
this.instance = localforage.createInstance(
|
|
26
|
-
Object.assign(options, { driver,
|
|
25
|
+
Object.assign(options, { driver, storeName: options.name })
|
|
27
26
|
);
|
|
28
27
|
this.iterate = this.instance.iterate;
|
|
29
28
|
this.keys = this.instance.keys;
|
|
@@ -112,5 +111,5 @@ class Store {
|
|
|
112
111
|
|
|
113
112
|
|
|
114
113
|
export default {
|
|
115
|
-
store: (options:
|
|
114
|
+
store: (options: Options): Store => new Store(options)
|
|
116
115
|
};
|