Extract worker creation into factories and mack them in tests
This commit is contained in:
parent
ccee4c9cdb
commit
74961dbfb1
10 changed files with 84 additions and 10 deletions
|
@ -23,6 +23,7 @@ import {
|
|||
IndexedDBStore,
|
||||
LocalStorageCryptoStore,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import indexeddbWorkerFactory from "../workers/indexeddbWorkerFactory";
|
||||
|
||||
const localStorage = window.localStorage;
|
||||
|
||||
|
@ -52,7 +53,7 @@ export default function createMatrixClient(opts: ICreateClientOpts): MatrixClien
|
|||
indexedDB: indexedDB,
|
||||
dbName: "riot-web-sync",
|
||||
localStorage,
|
||||
workerFactory: () => new Worker(new URL("../workers/indexeddb.worker.ts", import.meta.url)),
|
||||
workerFactory: indexeddbWorkerFactory,
|
||||
});
|
||||
} else if (localStorage) {
|
||||
storeOpts.store = new MemoryStore({ localStorage });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue