Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 88c0434

Browse files
authored
Merge pull request #792 from matrix-org/dbkr/indexeddb_webworker
Add support for using indexeddb in a webworker
2 parents 6352784 + b78f654 commit 88c0434

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/MatrixClientPeg.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ class MatrixClientPeg {
5050
this.opts = {
5151
initialSyncLimit: 20,
5252
};
53+
this.indexedDbWorkerScript = null;
54+
}
55+
56+
/**
57+
* Sets the script href passed to the IndexedDB web worker
58+
* If set, a separate web worker will be started to run the IndexedDB
59+
* queries on.
60+
*
61+
* @param {string} script href to the script to be passed to the web worker
62+
*/
63+
setIndexedDbWorkerScript(script) {
64+
this.indexedDbWorkerScript = script;
5365
}
5466

5567
get(): MatrixClient {
@@ -129,6 +141,7 @@ class MatrixClientPeg {
129141
indexedDB: window.indexedDB,
130142
dbName: "riot-web-sync",
131143
localStorage: localStorage,
144+
workerScript: this.indexedDbWorkerScript,
132145
});
133146
}
134147

0 commit comments

Comments
 (0)