Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v11 here: TYPO3 ELTS.
Throttle event
A "throttled event" executes its handler after a configured waiting time over a time span. This event type is similar to the debounced event, where the major difference is that a throttled event executes its listeners multiple times.
To construct the event listener, the module TYPO3/
must be imported. The constructor
accepts the following arguments:
event
(string) - the event to listen onName callback
(function) - the executed event listener when the event is triggeredlimit
(number) - the amount of milliseconds to wait until the event listener is executed again
Hint
If an event spans over 2000ms and the wait time is configured to be 100ms, the event listener gets called up to 20 times in total ().
new ThrottleEvent('mousewheel', function (e) {
console.log('Executed every 50ms during the overall event time span');
}, 50).bindTo(document.body);