Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
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') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment