From b78f6544761d632be58862356beedccfd89266e9 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 6 Apr 2017 11:13:39 +0100 Subject: [PATCH] Add support for using indexeddb in a webworker --- src/MatrixClientPeg.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js index d92973ba7a..452b67c4ee 100644 --- a/src/MatrixClientPeg.js +++ b/src/MatrixClientPeg.js @@ -50,6 +50,18 @@ class MatrixClientPeg { this.opts = { initialSyncLimit: 20, }; + this.indexedDbWorkerScript = null; + } + + /** + * Sets the script href passed to the IndexedDB web worker + * If set, a separate web worker will be started to run the IndexedDB + * queries on. + * + * @param {string} script href to the script to be passed to the web worker + */ + setIndexedDbWorkerScript(script) { + this.indexedDbWorkerScript = script; } get(): MatrixClient { @@ -129,6 +141,7 @@ class MatrixClientPeg { indexedDB: window.indexedDB, dbName: "riot-web-sync", localStorage: localStorage, + workerScript: this.indexedDbWorkerScript, }); }