olm/javascript/olm_suffix.js

37 lines
944 B
JavaScript
Raw Permalink Normal View History

var olmInitPromise;
olm_exports['init'] = function(opts) {
if (olmInitPromise) return olmInitPromise;
if (opts) OLM_OPTIONS = opts;
olmInitPromise = new Promise(function(resolve, reject) {
onInitSuccess = function() {
resolve();
};
onInitFail = function(err) {
reject(err);
};
Module();
});
return olmInitPromise;
};
2020-10-03 03:46:15 +02:00
return olm_exports;
})();
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-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
}