mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
7 lines
355 B
TypeScript
7 lines
355 B
TypeScript
// Easier wrapper over mutation observer, which takes an element, a callback, and returns an unsubscribe fn
|
|
export function observeElement(el: HTMLElement, callback: MutationCallback): () => void {
|
|
const observer = new MutationObserver(callback);
|
|
observer.observe(el, { childList: true, subtree: true });
|
|
return () => observer.disconnect();
|
|
}
|