Only emit umi:ui:message_add event when we're actually generating an element.

This commit is contained in:
Pachira 2024-02-20 20:58:01 +00:00
parent cdabf80e1c
commit c792faa042

View file

@ -11,18 +11,16 @@
#include ui/emotes.js
Umi.UI.Messages = (function() {
let forceUserInfo = false,
lastMsgUser = null,
lastMsgChannel = null,
lastWasTiny = null;
let forceUserInfo = false;
let lastMsgUser = null;
let lastMsgChannel = null;
let lastWasTiny = null;
const title = new MamiWindowTitle({
getName: () => futami.get('title'),
});
window.addEventListener('focus', function() {
title.clear();
});
window.addEventListener('focus', () => title.clear());
const botMsgs = {
'say': { text: '%0' },
@ -393,7 +391,7 @@ Umi.UI.Messages = (function() {
mami.sound.library.play(soundName, soundVolume, soundRate);
}
if(window.CustomEvent)
if(eBase instanceof HTMLElement)
window.dispatchEvent(new CustomEvent('umi:ui:message_add', {
detail: {
element: eBase,