javascript - Fastest debounce implementation -
In my application, I have some heavy functions in the scrolling event. To limit the frequency of execution, Using the method:
var timeout; Document.addEventListener ("scroll", function () {explicit timeout (timeout); timeout = set timeout (function () {// some heavy code}, 200);});
Is there a better way to do this? Is not set up from time to time to be very heavy to fire?
EDIT: What concerns me with the most memory usage - I think every settimeout is allocating something, it is a memory allocation from the Chrome timeline (this bella :):
< P>
Comments
Post a Comment