diff --git a/mods/emoji-sets/mod.js b/mods/emoji-sets/mod.js index e2d3791..b14b5c6 100644 --- a/mods/emoji-sets/mod.js +++ b/mods/emoji-sets/mod.js @@ -1,6 +1,7 @@ /* * emoji sets * (c) 2020 dragonwocky (https://dragonwocky.me/) + * (c) minor fixes by Arecsu from martyr⁠— (https://martyr.shop/) * under the MIT license */ @@ -47,13 +48,19 @@ module.exports = { if (!queue.length) requestAnimationFrame(handle); queue.push(...list); }); - observer.observe(document.body, { - childList: true, - subtree: true, - characterData: true, - }); + + const observe = ()=> { + observer.observe(document.body, { + childList: true, + subtree: true, + characterData: true, + }); + }; + observe(); // initiate observer + function handle() { queue = []; + observer.disconnect(); // stop observer from getting stuck into an infinite loop from here const isMac = process.platform === 'darwin', native = (store().style === 'microsoft' && process.platform === 'win32') || @@ -139,6 +146,7 @@ module.exports = { } tweaked = true; } + observe(); // re-initiating the observer now that we don't risk an infinite loop } }); },