xmpp.chapril.org-conversejs/src/components/converse.js
JC Brand 4e7b29e417 Make sure initialize can be awaited...
before `converse.initialize` has been called

In the process, remove other "core" promises. There is no core or
community plugins code awaiting on them and since it's possible to
call `converse.initialize` twice, I'm not sure it makes sense to even have them.

Also removed unused error class IllegalMessage.
2020-09-03 17:07:44 +02:00

20 lines
515 B
JavaScript

import { api, converse } from "@converse/headless/converse-core";
/**
* `converse-root` is an optional custom element which can be used to
* declaratively insert the Converse UI into the DOM.
*
* It can be inserted into the DOM before or after Converse has loaded or been
* initialized.
*/
class ConverseRoot extends HTMLElement {
async connectedCallback () {
await api.waitUntil('initialized');
converse.insertInto(this);
}
}
customElements.define('converse-root', ConverseRoot);