How to do something after any dom update by svelte on the page #5100
-
Hi, I want to execute a function after any dom update caused by Svelte on the page. I am aware of The reason for doing it is for custom instrumentation for various interactive elements. Newly added components could have this custom instrumentation which needs to be updated as this element would get added on the dom later. One working solution is through using I was wondering if anyone has any good workarounds /ideas for this issue. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
What do you mean by "instrumentation" ? If not, |
Beta Was this translation helpful? Give feedback.
What do you mean by "instrumentation" ?
I have the strange feeling you are trying to do something that is already perfectly possible with Svelte without doing something as abstract as detecting any DOM change.
If not,
MutationObserver
is what you need (but you probably don't)