Avoid setInterval and use MutationObserver
Closed this issue · 2 comments
mattiagalati commented
In your code you make use of setInterval
to check if left nav panel is loaded, and clear that interval when the dom you need is ready.
I would suggest you to use a MutationObserver instead, in order to tell the browser to notify your code when the dom is ready.
kevinwucodes commented
I've never used MutationObserver before. I'll look into it, thanks.
kevinwucodes commented
I looked at this and it appears that MutationObserver can't observe nodes if that node doesn't already exist. Not sure if using MutationObserver is still achieveable.