Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3376935
D8117.id27759.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D8117.id27759.diff
View Options
diff --git a/web/database/utils/constants.js b/web/database/utils/constants.js
--- a/web/database/utils/constants.js
+++ b/web/database/utils/constants.js
@@ -1,5 +1,7 @@
// @flow
+import localforage from 'localforage';
+
export const SQLITE_CONTENT = 'sqliteFileContent';
export const SQLITE_ENCRYPTION_KEY = 'encryptionKey';
@@ -21,3 +23,11 @@
'firefox',
'opera',
];
+
+export const localforageConfig: PartialConfig = {
+ driver: localforage.INDEXEDDB,
+ name: 'comm',
+ storeName: 'commStorage',
+ description: 'Comm encrypted database storage',
+ version: '1.0',
+};
diff --git a/web/database/worker/db-worker.js b/web/database/worker/db-worker.js
--- a/web/database/worker/db-worker.js
+++ b/web/database/worker/db-worker.js
@@ -40,6 +40,7 @@
} from '../queries/storage-engine-queries.js';
import {
CURRENT_USER_ID_KEY,
+ localforageConfig,
SQLITE_CONTENT,
SQLITE_ENCRYPTION_KEY,
} from '../utils/constants.js';
@@ -49,13 +50,6 @@
generateDatabaseCryptoKey,
} from '../utils/worker-crypto-utils.js';
-const localforageConfig: PartialConfig = {
- driver: localforage.INDEXEDDB,
- name: 'comm',
- storeName: 'commStorage',
- description: 'Comm encrypted database storage',
- version: '1.0',
-};
localforage.config(localforageConfig);
let sqliteDb: ?SqliteDatabase = null;
diff --git a/web/root.js b/web/root.js
--- a/web/root.js
+++ b/web/root.js
@@ -1,5 +1,6 @@
// @flow
+import localforage from 'localforage';
import * as React from 'react';
import { Provider } from 'react-redux';
import { Router, Route } from 'react-router';
@@ -13,6 +14,7 @@
import App from './app.react.js';
import { SQLiteDataHandler } from './database/sqlite-data-handler.js';
+import { localforageConfig } from './database/utils/constants.js';
import ErrorBoundary from './error-boundary.react.js';
import Loading from './loading.react.js';
import { persistConfig } from './redux/persist.js';
@@ -20,6 +22,8 @@
import history from './router-history.js';
import Socket from './socket.react.js';
+localforage.config(localforageConfig);
+
declare var preloadedState: AppState;
const persistedReducer = persistReducer(persistConfig, reducer);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 28, 2:58 AM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2592531
Default Alt Text
D8117.id27759.diff (2 KB)
Attached To
Mode
D8117: [web] initialize `localforage` on main thread
Attached
Detach File
Event Timeline
Log In to Comment