aboutsummaryrefslogtreecommitdiff
path: root/javascript/olm_suffix.js
diff options
context:
space:
mode:
Diffstat (limited to 'javascript/olm_suffix.js')
-rw-r--r--javascript/olm_suffix.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/javascript/olm_suffix.js b/javascript/olm_suffix.js
new file mode 100644
index 0000000..023c0a5
--- /dev/null
+++ b/javascript/olm_suffix.js
@@ -0,0 +1,23 @@
+olm_exports['init'] = function() {
+ return new Promise(function(resolve, reject) {
+ onInitSuccess = function() {
+ resolve();
+ };
+ onInitFail = function(err) {
+ reject(err);
+ };
+ Module();
+ });
+};
+
+if (typeof(window) !== 'undefined') {
+ // We've been imported directly into a browser. Define the global 'Olm' object.
+ // (we do this even if module.exports was defined, because it's useful to have
+ // Olm in the global scope for browserified and webpacked apps.)
+ 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;