1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-09 10:22:46 +03:00

Make Olm work with browserified js-sdk

We want to avoid distributing olm as part of the js-sdk, so we exclude it from
the browserified build. Previously this meant that you couldn't use olm this
way.

We can do better though: if the web page includes olm.js via a separate script
tag, that will set global.Olm, which we can get browserify to shim in.
This commit is contained in:
Richard van der Hoff
2017-01-27 17:15:35 +00:00
parent e71e32122c
commit c6e21c9c5c
2 changed files with 14 additions and 2 deletions

View File

@@ -21,6 +21,11 @@ limitations under the License.
* @module crypto/OlmDevice
*/
const Olm = require("olm");
if (!Olm) {
// this happens if we were loaded via browserify and the Olm module was not
// loaded.
throw new Error("Olm is not defined");
}
const utils = require("../utils");