diff options
| author | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2023-02-13 22:49:42 +0530 |
|---|---|---|
| committer | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2023-02-13 22:49:42 +0530 |
| commit | 34ad953c953a395ba3e51c8125034a6bb65b2a79 (patch) | |
| tree | 253cc30047bb3963f387bd340d50938b3b727053 /src/utils/observe-dom.ts | |
| parent | aeeabaa0050ecb9e43b1a3fb309f314d92d3ca97 (diff) | |
| download | banglar-bhumi-utils-34ad953c953a395ba3e51c8125034a6bb65b2a79.tar.gz banglar-bhumi-utils-34ad953c953a395ba3e51c8125034a6bb65b2a79.zip | |
Fixed not being able to import modules in scripts.
Diffstat (limited to 'src/utils/observe-dom.ts')
| -rw-r--r-- | src/utils/observe-dom.ts | 8 |
1 files changed, 8 insertions, 0 deletions
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}); +}; |
