Lower the frequency of Javascript event polling

How do you lower the frequency of javascript event polling? The events I'm concerned about are onResize and onScroll. These events may be triggered dozens of times per second when someone resizes their browser or scrolls down, respectively. I'd like these events to happen only once every 500 ms so I don't have to spend hours optimizing my event handlers and making sure they don't leak memory.

7
задан JoJo 7 December 2010 в 02:04
поделиться