Open ferreiro opened 3 years ago
I'm building an extension that adds a custom panel to the sidebar. I got that working by checking every X milliseconds if the sidebar exists, and if so, inject my custom panel. But I wanted to improve that since it's quite inefficient to run those checks (especially at the first load).
Agreed.
Is there any way to accomplish that with your library?
Not currently.
If not, are there any ideas/insights on how to do it?
It's probably more efficient to use Mutation Observers for this, like we do for other DOM-based events.
If you can make that work, feel free to integrate it into the base library as a DOM-observer, and issue a PR :smiley:
@josteink Actually I'd be more than happy if I have that working! Apart from reading the code, do you have any doc/video, etc explaining how does the library work and manages the state?
A couple of questions to understand how the library works:
I see that we actually do more than use MutationObservers. We also use a DOMNodeInserted
-event (via jQuery), and that might be a better fit for this task:
Hey team!
First, congrats for making this library, it's rock solid and super helpful!
I'm building an extension that adds a custom panel to the sidebar. I got that working by checking every X milliseconds if the sidebar exists, and if so, inject my custom panel. But I wanted to improve that since it's quite inefficient to run those checks (especially at the first load).
Is there any way to accomplish that with your library? If not, are there any ideas/insights on how to do it?