v7.3.0
SupportExamplesFree Trial

ClickRepeater

A helper class, which, when applied to an element means that a mousedown and hold on that element will, after a configured delay, begin autorepeating click events on that element, starting at a rate of startRate clicks per second, and over accelerateDuration milliseconds, accelerate to firing clicks at endRate times per second.

An example of this is used by the NumberField's spinner triggers.

const repeater = new ClickRepeater({
    element  : document.getElementById('increment-btn'),
    delay    : 400,
    endRate  : 10
});

Useful configs

Config Description
element The element on which to fire repeating click events
delay Milliseconds to wait before repeating starts
startRate Initial clicks per second
endRate Maximum clicks per second after acceleration
accelerateDuration Time in ms to ramp from start rate to end rate

See also

  • NumberField - Uses ClickRepeater for spinner triggers
No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class

Source path

Core/util/ClickRepeater.js

Contents