From 34ad953c953a395ba3e51c8125034a6bb65b2a79 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Mon, 13 Feb 2023 22:49:42 +0530 Subject: Fixed not being able to import modules in scripts. --- src/utils/observe-dom.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/utils/observe-dom.ts (limited to 'src/utils/observe-dom.ts') diff --git a/src/utils/observe-dom.ts b/src/utils/observe-dom.ts new file mode 100644 index 0000000..e375326 --- /dev/null +++ b/src/utils/observe-dom.ts @@ -0,0 +1,8 @@ +export default (callback: () => boolean) => { + const observer = new MutationObserver(() => { + if (callback()) { + observer.disconnect(); + } + }); + observer.observe(document, {childList: true, subtree: true}); +}; -- cgit v1.2.3