how to cancel a settimeout code example
Example 1: cancel settimeout
var timer1 = setTimeout(function() { removeStatusIndicator(); }, statusTimeout);
clearTimeout(timer1)
Example 2: javascript cancel timeout
// wait 1000ms and then run func()
let myTimeout = setTimeout(func, 1000);
// cancel the timeout
clearTimeout(myTimeout);