aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/observe-dom.ts
diff options
context:
space:
mode:
authorArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-02-14 11:53:09 +0530
committerArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-02-14 11:53:09 +0530
commit1393f99b39906f85689f7781da188e6fb414eaf6 (patch)
treed93096f5974926dd7ceccc3e43fd25df3681b324 /src/utils/observe-dom.ts
parenta30b28d40e5bacdbbbcad3c9de8f1fe3e083119c (diff)
downloadbanglar-bhumi-utils-1393f99b39906f85689f7781da188e6fb414eaf6.tar.gz
banglar-bhumi-utils-1393f99b39906f85689f7781da188e6fb414eaf6.zip
Added some style changes.
Diffstat (limited to 'src/utils/observe-dom.ts')
-rw-r--r--src/utils/observe-dom.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/utils/observe-dom.ts b/src/utils/observe-dom.ts
index 30a07b4..8ea1a98 100644
--- a/src/utils/observe-dom.ts
+++ b/src/utils/observe-dom.ts
@@ -1,8 +1,12 @@
-export const observeDOM = (callback: () => boolean) => {
+export const observeDOM = (callback: () => boolean, element: HTMLElement = document as unknown as HTMLElement) => {
const observer = new MutationObserver(() => {
if (callback()) {
observer.disconnect();
}
});
- observer.observe(document, {childList: true, subtree: true});
+
+ observer.observe(element, {
+ childList: true,
+ subtree: true
+ });
};