I want to set a timeout and an Interval as an onmousedown eventhandler for this function.
function start(clicked_className,clicked_classValue)
{
add(clicked_className,clicked_classValue);
}
startInter=setInterval(start.bind(null,y.className, y.value.replace(/\s/g, '')),600);
That's what I have as working Interval, but don't know how to add timeout without it being 2 separate things. I want the Interval to have a timeout.
You can just put setInterval
inside setTimeout
function, something like:
el.onmousedown = function() {
start(...)
setTimeout(function(){
// start(...) // maybe also here?
setInterval(function(){
start(...)
},1000)
},5000)
}