m-gagne / limit.js

JavaScript event/call debounce & limit helper
MIT License
177 stars 14 forks source link

Add trailing execution #8

Open vuhrmeister opened 9 years ago

vuhrmeister commented 9 years ago

Provide an option to enable trailing execution of the callback. This is the way jQuery throttle / debounce implemented it.

I cannot use your plugin. I have a Back-to-Top-Button which should disappear when window.scrollTop() is above 500px or so. So if the user scrolls quite fast, there will be no execution in the top 500px area and the button won't disappear.

mdeanda commented 7 years ago

this was the first thing i looked for when i peeked at the code. i was considering this implementation until i saw it was missing the trailing execution. for typical cases i'd expect it to be the default.