Stop setInterval call in JavaScript -


i using setinterval(fname, 10000); call function every 10 seconds in javascript. possible stop calling on event?

i want user able stop repeated refresh of data.

setinterval() returns interval id, can pass clearinterval():

var refreshintervalid = setinterval(fname, 10000);  /* later */ clearinterval(refreshintervalid); 

see docs setinterval() , clearinterval().


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -