diff --git a/javascript/olm_suffix.js b/javascript/olm_suffix.js index 023c0a5..ec0e39b 100644 --- a/javascript/olm_suffix.js +++ b/javascript/olm_suffix.js @@ -1,5 +1,8 @@ +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') {