Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: add readMulti

thecodrr6eb1fc63b78f
diff --git a/apps/web/package.json b/apps/web/package.json
index e1b939807..cafa09482 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -9,6 +9,7 @@
"framer-motion": "^1.9.1",
"immer": "^5.3.6",
"localforage": "^1.7.3",
+ "localforage-getitems": "^1.4.2",
"notes-core": "npm:@streetwriters/notesnook-core@latest",
"quill": "https://github.com/thecodrr/quill.git#1.3.7",
"quill-magic-url": "^1.0.3",
diff --git a/apps/web/src/interfaces/storage.js b/apps/web/src/interfaces/storage.js
index 74fe6e542..7439a80f1 100644
--- a/apps/web/src/interfaces/storage.js
+++ b/apps/web/src/interfaces/storage.js
@@ -6,18 +6,26 @@ const decoder = new TextDecoder();
localforage.config({
name: "Notesnook",
+ storeName: "Notesnook store",
driver: [localforage.INDEXEDDB, localforage.WEBSQL, localforage.LOCALSTORAGE]
});
-async function read(key) {
+function read(key) {
return localforage.getItem(key);
}
-async function write(key, data) {
+
+function readMulti(keys) {
+ return localforage.getItems(keys);
+}
+
+function write(key, data) {
return localforage.setItem(key, data);
}
+
function remove(key) {
return localforage.removeItem(key);
}
+
function clear() {
return localforage.clear();
}
@@ -52,6 +60,7 @@ async function decrypt(password, data) {
export default {
read,
+ readMulti,
write,
remove,
clear,
diff --git a/apps/web/yarn.lock b/apps/web/yarn.lock
index 172b05c78..a934532ee 100644
--- a/apps/web/yarn.lock
+++ b/apps/web/yarn.lock
@@ -6321,7 +6321,14 @@ loader-utils@^1.0.1, loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2
emojis-list "^3.0.0"
json5 "^1.0.1"
-localforage@^1.7.3:
+localforage-getitems@^1.4.2:
+ version "1.4.2"
+ resolved "https://registry.yarnpkg.com/localforage-getitems/-/localforage-getitems-1.4.2.tgz#bddd3e716e7df339dc5a5cc26e2dd1decec76606"
+ integrity sha512-3Y1DAAlRjGlhWAXoD1DR8M+7WF9DC6t8CvYZ7YKVnIJBpima8j4RsWUv1ryJKB+fTPozfDxeqrN7ooqzBPyB4g==
+ dependencies:
+ localforage ">=1.4.0"
+
+localforage@>=1.4.0, localforage@^1.7.3:
version "1.7.3"
resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.7.3.tgz#0082b3ca9734679e1bd534995bdd3b24cf10f204"
integrity sha512-1TulyYfc4udS7ECSBT2vwJksWbkwwTX8BzeUIiq8Y07Riy7bDAAnxDaPU/tWyOVmQAcWJIEIFP9lPfBGqVoPgQ==