Provides key hold-start, holding, hold-end and other events.
The 1st argument is a KeyboardEvent.code
.
const keyLeft = new holdEvent.KeyboardKeyHold( 'ArrowLeft' );
keyLeft.addEventListener( holdEvent.HOLD_EVENT_TYPE.HOLD_START, ( event ) => console.log( event ) );
keyLeft.addEventListener( holdEvent.HOLD_EVENT_TYPE.HOLDING, ( event ) => console.log( event ) );
keyLeft.addEventListener( holdEvent.HOLD_EVENT_TYPE.HOLD_END, ( event ) => console.log( event ) );
const $button = document.getElementById( 'button' )
const buttonHold = new holdEvent.ElementHold( $button );
buttonHold.addEventListener( holdEvent.HOLD_EVENT_TYPE.HOLD_START, ( event ) => console.log( event ) );
buttonHold.addEventListener( holdEvent.HOLD_EVENT_TYPE.HOLDING, ( event ) => console.log( event ) );
buttonHold.addEventListener( holdEvent.HOLD_EVENT_TYPE.HOLD_END, ( event ) => console.log( event ) );