瀏覽代碼

fix(sqlite): multitab support

Andelf 2 年之前
父節點
當前提交
0836e4f6cc

+ 10 - 9
deps/persist-db/src/index.js

@@ -93,15 +93,16 @@ const SQLiteDB = {
     },
     },
     async init() {
     async init() {
         console.log("[worker] calling init");
         console.log("[worker] calling init");
-        const module = await SQLiteModuleFactory();
-        sqlite3 = SQLite.Factory(module);
-        // OPFS is not supported in shared worker
-        // const vfs = new OriginPrivateFileSystemVFS();
-        const vfs = new IDBBatchAtomicVFS("logseq-VFS");
-        await vfs.isReady;
-        sqlite3.vfs_register(vfs, true);
-        console.log("[worker] SQLite vfs init ok")
-        return;
+        if (typeof sqlite3 === "undefined") {
+            const module = await SQLiteModuleFactory();
+            sqlite3 = SQLite.Factory(module);
+            // OPFS is not supported in shared worker
+            // const vfs = new OriginPrivateFileSystemVFS();
+            const vfs = new IDBBatchAtomicVFS("logseq-VFS");
+            await vfs.isReady;
+            sqlite3.vfs_register(vfs, true);
+            console.log("[worker] SQLite vfs init ok")
+        }
     },
     },
     // aka. newDB and openDB
     // aka. newDB and openDB
     // :db-new
     // :db-new

文件差異過大導致無法顯示
+ 0 - 0
resources/js/ls-wa-sqlite/persist-db-worker.js


文件差異過大導致無法顯示
+ 0 - 0
resources/js/ls-wa-sqlite/persist-db-worker.js.map


部分文件因文件數量過多而無法顯示