Repeated events for pressing and holding down DOM elements.
$ npm install on-hold
Holding down the button will call the function repeatedly:
var onHold = require('on-hold')
var btn = document.createElement('button')
btn.textContent = 'Press and Hold'
onHold(btn, function () {
console.log('action fired')
})
document.body.appendChild(btn)
DOM element to attach events to.
wait
: initial time in ms to hold down before repeating action.interval
: interval in ms between repeated actions after inital hold down.
Event handler function.
MIT