Commit dfbe8a47 authored by David Baker's avatar David Baker
Browse files

Return same promise if init() called many times

So we only init the library once.
parent 263b9442
var olmInitPromise;
olm_exports['init'] = function() {
return new Promise(function(resolve, reject) {
if (olmInitPromise) return olmInitPromise;
olmInitPromise = new Promise(function(resolve, reject) {
onInitSuccess = function() {
resolve();
};
......@@ -8,6 +11,7 @@ olm_exports['init'] = function() {
};
Module();
});
return olmInitPromise;
};
if (typeof(window) !== 'undefined') {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment