aboutsummaryrefslogtreecommitdiff
path: root/javascript
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2018-10-10 20:15:40 +0100
committerDavid Baker <dave@matrix.org>2018-10-10 20:15:40 +0100
commite73ebcea67b50ada065a362ec774bd66ec47b065 (patch)
tree7985ce06cb2a30f5b582fcec416c95f725a30dff /javascript
parentf6e3f7f44aef5bb84173e87869928bd9922aaf96 (diff)
parent3cfcf1615dfe434e1aa10d5c904d537b159e1566 (diff)
Merge remote-tracking branch 'origin/master' into dbkr/pk_private_export_import
Diffstat (limited to 'javascript')
-rw-r--r--javascript/olm_post.js10
-rw-r--r--javascript/olm_pre.js10
-rw-r--r--javascript/olm_suffix.js10
3 files changed, 16 insertions, 14 deletions
diff --git a/javascript/olm_post.js b/javascript/olm_post.js
index fffffad..21ea890 100644
--- a/javascript/olm_post.js
+++ b/javascript/olm_post.js
@@ -463,13 +463,3 @@ olm_exports["get_library_version"] = restore_stack(function() {
getValue(buf+2, 'i8'),
];
});
-
-Module['onRuntimeInitialized'] = function() {
- OLM_ERROR = Module['_olm_error']();
- olm_exports["PRIVATE_KEY_LENGTH"] = Module['_olm_pk_private_key_length']();
- if (onInitSuccess) onInitSuccess();
-};
-
-Module['onAbort'] = function(err) {
- if (onInitFail) onInitFail(err);
-};
diff --git a/javascript/olm_pre.js b/javascript/olm_pre.js
index 4feff97..314d7da 100644
--- a/javascript/olm_pre.js
+++ b/javascript/olm_pre.js
@@ -37,3 +37,13 @@ if (typeof(OLM_OPTIONS) !== 'undefined') {
* use UTF8ToString.
*/
var NULL_BYTE_PADDING_LENGTH = 1;
+
+Module['onRuntimeInitialized'] = function() {
+ OLM_ERROR = Module['_olm_error']();
+ olm_exports["PRIVATE_KEY_LENGTH"] = Module['_olm_pk_private_key_length']();
+ if (onInitSuccess) onInitSuccess();
+};
+
+Module['onAbort'] = function(err) {
+ if (onInitFail) onInitFail(err);
+};
diff --git a/javascript/olm_suffix.js b/javascript/olm_suffix.js
index 7f19953..3e2f664 100644
--- a/javascript/olm_suffix.js
+++ b/javascript/olm_suffix.js
@@ -24,7 +24,9 @@ if (typeof(window) !== 'undefined') {
window["Olm"] = olm_exports;
}
-// Emscripten sets the module exports to be its module
-// with wrapped c functions. Clobber it with our higher
-// level wrapper class.
-module.exports = olm_exports;
+if (typeof module === 'object') {
+ // Emscripten sets the module exports to be its module
+ // with wrapped c functions. Clobber it with our higher
+ // level wrapper class.
+ module.exports = olm_exports;
+}