Commit fa305639 authored by JC Brand's avatar JC Brand

Don't assume that window.converse is always defined

parent 089a5428
......@@ -4,13 +4,14 @@
* @license Mozilla Public License (MPLv2)
*/
import "@converse/headless/converse-emoji";
import { View } from "skeletor.js/src/view";
import { debounce, find } from "lodash";
import DOMNavigator from "./dom-navigator";
import bootstrap from "bootstrap.native";
import emoji_picker from "templates/emoji_picker.js";
import sizzle from 'sizzle';
import tpl_emoji_button from "templates/emoji_button.html";
import { View } from "skeletor.js/src/view";
import { converse } from '@converse/headless/converse-core';
import { debounce, find } from "lodash";
const u = converse.env.utils;
......
......@@ -1737,7 +1737,7 @@ function setUnloadEvent () {
}
}
export const converse = window.converse;
export const converse = window.converse || {};
/**
......@@ -1912,4 +1912,6 @@ Object.assign(converse, {
* @event converse-loaded
* @example window.addEventListener('converse-loaded', () => converse.initialize());
*/
window.dispatchEvent(new CustomEvent('converse-loaded'));
const ev = new CustomEvent('converse-loaded')
ev.converse = converse;
window.dispatchEvent(ev);
Markdown is supported
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