I've been working on profiling a scroll view in my application that was inexplicably slow and ran into something interesting. I have a component that needs to update its styles every frame during scroll animation.
To do this, I have a handler for the
onScroll event that calculates and applies the necessary changes. To achieve yank-free 60fps scrolling, this handler has to execute within a 16ms budget. However, it took roughly 45ms instead, leading to a bad scroll experience.
After some profiling, it appears that simply bubbling a single
onScroll event was taking a whopping ~37ms! However, almost none of the components that receive and propagate the event had any handlers to execute. It seems a lot of time is wasted simply by passing the event from one component to the next.
So this leads me to the question:
Is there a way for one component listen to another component's events *directly* without the need for multiple intermediaries to propagate the event through the component tree?
I'm thinking along the lines of observer support, which can be used to watch for changes on very specific components without the need for a chain of multiple levels of bindings. Does Enyo have a similar mechanism I can use for the