Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32220050
D7190.1765190502.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D7190.1765190502.diff
View Options
diff --git a/web/redux/comm-redux-storage-engine.js b/web/redux/comm-redux-storage-engine.js
new file mode 100644
--- /dev/null
+++ b/web/redux/comm-redux-storage-engine.js
@@ -0,0 +1,32 @@
+// @flow
+
+import { databaseModule } from '../database/database-module-provider.js';
+import { workerRequestMessageTypes } from '../types/worker-types.js';
+
+const commReduxStorageEngine = {
+ getItem: async (key: string): Promise<string> => {
+ const result = await databaseModule.schedule({
+ type: workerRequestMessageTypes.GET_PERSIST_STORAGE_ITEM,
+ key,
+ });
+ if (typeof result?.item !== 'string') {
+ throw new Error('Wrong type returned for storage item');
+ }
+ return result.item;
+ },
+ setItem: async (key: string, item: string): Promise<void> => {
+ await databaseModule.schedule({
+ type: workerRequestMessageTypes.SET_PERSIST_STORAGE_ITEM,
+ key,
+ item,
+ });
+ },
+ removeItem: async (key: string): Promise<void> => {
+ await databaseModule.schedule({
+ type: workerRequestMessageTypes.REMOVE_PERSIST_STORAGE_ITEM,
+ key,
+ });
+ },
+};
+
+export default commReduxStorageEngine;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 8, 10:41 AM (10 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5847925
Default Alt Text
D7190.1765190502.diff (1 KB)
Attached To
Mode
D7190: [web-db] implement custom `redux-persist` storage
Attached
Detach File
Event Timeline
Log In to Comment