2018-09-25 18:48:17 +02:00
|
|
|
var olmInitPromise;
|
|
|
|
|
2018-09-26 17:38:39 +02:00
|
|
|
olm_exports['init'] = function(opts) {
|
2018-09-25 18:48:17 +02:00
|
|
|
if (olmInitPromise) return olmInitPromise;
|
2018-09-26 17:38:39 +02:00
|
|
|
|
|
|
|
if (opts) OLM_OPTIONS = opts;
|
|
|
|
|
2018-09-25 18:48:17 +02:00
|
|
|
olmInitPromise = new Promise(function(resolve, reject) {
|
2018-09-25 18:13:29 +02:00
|
|
|
onInitSuccess = function() {
|
|
|
|
resolve();
|
|
|
|
};
|
|
|
|
onInitFail = function(err) {
|
|
|
|
reject(err);
|
|
|
|
};
|
|
|
|
Module();
|
|
|
|
});
|
2018-09-25 18:48:17 +02:00
|
|
|
return olmInitPromise;
|
2018-09-25 18:13:29 +02:00
|
|
|
};
|
|
|
|
|
2020-10-03 03:46:15 +02:00
|
|
|
return olm_exports;
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
2018-09-25 18:13:29 +02:00
|
|
|
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.)
|
2020-10-03 03:46:15 +02:00
|
|
|
window["Olm"] = Olm;
|
2018-09-25 18:13:29 +02:00
|
|
|
}
|
|
|
|
|
2018-10-04 21:09:54 +02:00
|
|
|
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.
|
2020-10-03 03:46:15 +02:00
|
|
|
module.exports = Olm;
|
2018-10-04 21:09:54 +02:00
|
|
|
}
|
2021-03-31 22:09:36 +02:00
|
|
|
|
|
|
|
// @license-end
|