frame-throttle
Advanced tools
Changelog
[3.0.0] - 2017-08-28
var throttledListener = throttle(listener);
window.addEventListener('resize', throttledListener);
submitButton.addEventListener('click', () => {
window.removeEventListener('resize', throttledListener);
// prevent any queued calls from executing on the next animation frame:
throttledListener.cancel();
});
throttle
will now return a function
of the same type it was passed.Binding a throttled listener with .bind()
resulted in both the bound and
unbound listeners being throttled together.
For instance, in the following scenario, listener
was only being called once:
var throttledListener = throttle(listener);
var boundThrottledListener1 = throttledListener.bind(someContext);
var boundThrottledListener2 = throttledListener.bind(anotherContext);
throttledListener();
boundThrottledListener1();
boundThrottledListener2();
Changelog
[2.0.1] - 2016-09-26
package.json
was misconfigured and didn't include the correct filesChangelog
[1.1.0] - 2016-08-23
setTimeout
use case