2
0
Эх сурвалжийг харах

Set `converse` on the window and trigger an event after loaded.

Setting it on `window` is necessary to have it available inside a
webcomponent.

Triggering an event is necessary so that we don't call
`converse.initialize` too early.
JC Brand 7 жил өмнө
parent
commit
ba9c3b01ed
1 өөрчлөгдсөн 3 нэмэгдсэн , 1 устгасан
  1. 3 1
      src/converse-core.js

+ 3 - 1
src/converse-core.js

@@ -2003,7 +2003,7 @@
     };
 
     // The public API
-    return {
+    window.converse = {
         'initialize' (settings, callback) {
             return _converse.initialize(settings, callback);
         },
@@ -2035,4 +2035,6 @@
             'utils': utils
         }
     };
+    window.dispatchEvent(new Event('converse-loaded'));
+    return window.converse;
 }));