Переделал сам
class dynamicTimer {
constructor(func, delay) {
this.callback = func
this.triggerTime = delay
this.timer = 0
this.updateTimer()
}
updateTimer() {
clearTimeout(this.timer)
let delay = this.triggerTime
// console.log("Current delay: ", delay)
this.timer = setTimeout(this.callback, delay)
return this
}
addTime(delay) {
this.triggerTime = delay
this.updateTimer()
return this
}
}
let timer = new dynamicTimer(function() {
$('.status-on').css({'display':"none"})
}, 3000)
$('html').on('click', '.ApiOnline', function () {
timer.addTime(3000)
})