setinterval break after first interval code example
Example 1: setinterval break
var refreshIntervalId = setInterval(fname, 10000);
/* later */
clearInterval(refreshIntervalId);
Example 2: setinterval stop onditional stop
var myTimer = setInterval(...);
clearInterval(myTimer);