0

I have a set of nested DOM elements with mouse event handlers (mouseover, mouseout). Side effects of the events update other views; these updates are potentially computationally expensive, and can create annoying visual flicker, so I would like to minimize them. My first thought was to build a throttling mechanism that delays the handling of a mouse-over event for some interval, giving the mouse a chance to exit the element in question. If no exit occurs within the specified interval, the event is fired; if an exit occurs, the event is canceled without being propagated.

My question is whether existing UI frameworks already support such mechanisms, and, if so, which ones do so? While I can certainly build this, it seems like a problem that others might have solved already.

Gene Golovchinsky
  • 6,101
  • 7
  • 53
  • 81

1 Answers1

1

You can use underscore js' throttle on your mouse event handlers. This was recently blogged about on the toggl blog: http://blog.toggl.com/2013/02/increasing-perceived-performance-with-_throttle/. There was some monkey patching of jQuery involved, though, so it's not the cleanest method.

ebsddd
  • 1,028
  • 9
  • 20
  • this is close, but not exactly my problem: I don't necessarily have lots of redundant events of which I would like to keep a subset; I have some events that may get suppressed entirely if the terminating event happens within a short-enough interval of the initiating event. – Gene Golovchinsky Mar 10 '13 at 22:59