You can store a reference to that timeout, and then call clearTimeout
on that reference.
// in the example above, assign the result
var timeoutHandle = window.setTimeout(...);
// in your click function, call clearTimeout
window.clearTimeout(timeoutHandle);
// then call setTimeout again to reset the timer
timeoutHandle = window.setTimeout(...);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…