aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/observe-dom.ts
blob: 30a07b433ff04718051c59a807e37f0fb6fb8d60 (plain)
1
2
3
4
5
6
7
8
export const observeDOM = (callback: () => boolean) => {
	const observer = new MutationObserver(() => {
		if (callback()) {
			observer.disconnect();
		}
	});
	observer.observe(document, {childList: true, subtree: true});
};