Event Matrix
October 19, 2025 ยท View on GitHub
Core Events
Standard Events
change- Native change event when value actually changesmin- Fired when minimum boundary is reachedmax- Fired when maximum boundary is reachedstartspin- Fired at the beginning of any spin operationstartupspin- Fired when starting an up spinstartdownspin- Fired when starting a down spinstopupspin- Fired when stopping an up spinstopdownspin- Fired when stopping a down spinstopspin- Fired at the end of any spin operationboostchange- Fired when boost level changes (payload:{ level, step, capped })
New Events (v5.0.1-alpha.7)
Cancelable Change Events
change:start- Fired before a change occurs, cancelable withevent.preventDefault()change:end- Fired after a change completes, cancelable withevent.preventDefault()
Speed Change Events
speedchange- Fired when spin speed changes between normal/fast modes- Payload:
{ speed: 'normal' | 'fast', previousSpeed: 'normal' | 'fast' }
- Payload:
Wrapper Events (jQuery)
All core events are mapped to jQuery-style events:
touchspin.on.mintouchspin.on.maxtouchspin.on.startspintouchspin.on.startupspintouchspin.on.startdownspintouchspin.on.stopupspintouchspin.on.stopdownspintouchspin.on.stopspintouchspin.on.boostchangetouchspin.on.change:start(cancelable)touchspin.on.change:end(cancelable)touchspin.on.speedchange
Event Timing
startspinthenstartupspin|startdownspinat spin startmin/maxBEFORE setting display when reaching boundary via single stepstopupspin|stopdownspinthenstopspinat spin endchange:startfires before any value change (cancelable)changefires when display actually changes via_setDisplay()change:endfires after change completes (cancelable)speedchangefires when transitioning between normal/fast spin speeds
Cancelable Events
Events marked as cancelable can be prevented by calling event.preventDefault():
input.addEventListener('change:start', (event) => {
// Prevent the change from happening
if (someCondition) {
event.preventDefault();
}
});
To enable cancelable events, set the cancelable option to true:
TouchSpin(input, {
cancelable: true, // Enable cancelable change events
// ... other options
});
Change Event Handling
- Core dispatches native
changewhen display actually changes via_setDisplay() - Core intercepts native
changein capture to prevent propagation of unsanitized values blur/Enterapply sanitization and emit finalchange- Cancelable events (
change:start,change:end) allow preventing changes entirely