-
-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
removeObserver() not working #69
Comments
Good point. I thought about that but as a first version I didn't implement it until I actually figure out some cases where we have performances issues with it. |
Yes, I have a table built with marionette.js and it has infinite scroll to show additional search results. So anywhere from 100 to a couple thousand mutations on a single query. Every time the user modifies the query, the current results get removed and another 100 get added. Within the table rows, there are a bunch of elements, too. So the events start to pile up. |
Hi, I just release a new version 2.3.0 that should solve this issue. |
Thanks. I spent some time on splitting the declarative (watching for the data-simplebar attribute) feature out last week: https://github.com/webxl/simplebar/tree/split-out-declarative. Not sure if you want to do it that way, but it might give you some ideas. I also worked on adding mocha tests, but I'm having trouble testing the mutation observer: https://github.com/webxl/simplebar/tree/unit-tests. I like testing things in node.js if possible, but for this, I might need to switch to karma-webpack so that we get the full browser API. |
Very interesting stuff. I liked the approach you proposed in your first comment with a "sub-module" |
Yeah, the naming is a bit odd. I wanted to keep it backward compatible. It's still loaded via a submodule though: https://github.com/webxl/simplebar/blob/unit-tests/test/imperative.js#L2 |
I was trying to disable the global mutation observer, but it's not working. globalObserver is never assigned to the static observer property:
Also, there should be a way to have opt-in global observers in addition to opt-out. I know there's the convenience factor, but for pages with a lot of DOM manipulation, this feature is very costly. so that would require manual instantiation. Perhaps there could be an alternate module, and you would import it with something like
import NotSoSimpleBar from 'simplebar/manual';
and they could share the bulk of code in some other module.The text was updated successfully, but these errors were encountered: