1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2026-01-03 23:22:30 +03:00

Fail gracefully on browsers without indexeddb

If we don't have indexeddb at all, don't try to make an indexeddb crypto store.
This commit is contained in:
Richard van der Hoff
2017-06-22 07:49:28 +01:00
parent db66023102
commit 8ef947722f

View File

@@ -1,13 +1,16 @@
var matrixcs = require("./lib/matrix");
matrixcs.request(require("browser-request"));
matrixcs.setCryptoStoreFactory(
function() {
return new matrixcs.IndexedDBCryptoStore(
global.indexedDB, "matrix-js-sdk:crypto"
);
}
);
// if our browser (appears to) support indexeddb, use an indexeddb crypto store.
if (global.indexedDB) {
matrixcs.setCryptoStoreFactory(
function() {
return new matrixcs.IndexedDBCryptoStore(
global.indexedDB, "matrix-js-sdk:crypto"
);
}
);
}
module.exports = matrixcs; // keep export for browserify package deps
global.matrixcs = matrixcs;