|
4 | 4 |
|
5 | 5 | import { createStore, del, set, get, clear, keys } from 'idb-keyval';
|
6 | 6 |
|
7 |
| -const ParseStore = createStore('parseDB', 'parseStore'); |
| 7 | +try { |
| 8 | + const ParseStore = createStore('parseDB', 'parseStore'); |
8 | 9 |
|
9 |
| -export const IndexedDBStorageController = { |
10 |
| - async: 1, |
11 |
| - getItemAsync(path: string) { |
12 |
| - return get(path, ParseStore); |
13 |
| - }, |
14 |
| - setItemAsync(path: string, value: string) { |
15 |
| - return set(path, value, ParseStore); |
16 |
| - }, |
17 |
| - removeItemAsync(path: string) { |
18 |
| - return del(path, ParseStore); |
19 |
| - }, |
20 |
| - getAllKeysAsync() { |
21 |
| - return keys(ParseStore); |
22 |
| - }, |
23 |
| - clear() { |
24 |
| - return clear(ParseStore); |
25 |
| - }, |
26 |
| -}; |
| 10 | + const IndexedDBStorageController = { |
| 11 | + async: 1, |
| 12 | + getItemAsync(path: string) { |
| 13 | + return get(path, ParseStore); |
| 14 | + }, |
| 15 | + setItemAsync(path: string, value: string) { |
| 16 | + return set(path, value, ParseStore); |
| 17 | + }, |
| 18 | + removeItemAsync(path: string) { |
| 19 | + return del(path, ParseStore); |
| 20 | + }, |
| 21 | + getAllKeysAsync() { |
| 22 | + return keys(ParseStore); |
| 23 | + }, |
| 24 | + clear() { |
| 25 | + return clear(ParseStore); |
| 26 | + }, |
| 27 | + }; |
27 | 28 |
|
28 |
| -module.exports = IndexedDBStorageController; |
| 29 | + module.exports = IndexedDBStorageController; |
| 30 | +} catch (e) { |
| 31 | + // IndexedDB not supported |
| 32 | +} |
0 commit comments