PXD

useRepeatAction

Repeats an action while pointer is pressed, with acceleration from initial interval to final interval.

Exports

function useRepeatAction(action: Callback): Results
function useRepeatAction(options: Options): Results

Types

interface Options {
  action: Callback
  disabled?: MaybeRefOrGetter<boolean>
  finalInterval?: number
  initialInterval?: number
  accelerationDuration?: number
}

interface Results {
  start: Callback
  stop: Callback
}

Params

NameTypeDescription
actionCallbackThe action to repeat
options.actionCallbackThe action to repeat
options.disabledMaybeRefOrGetter<boolean>Whether the repeat action is disabled
options.finalIntervalnumberThe final repeat interval in milliseconds
options.initialIntervalnumberThe initial repeat interval in milliseconds
options.accelerationDurationnumberDuration in milliseconds to accelerate from initial to final interval

Source

Source