javascript - setInterval() is not working properly for inactive tab -


i developing 1 timer taking record of time. using setinterval method of java script problem it's not working if tab inactive.

one solution got store old time , subtract new time 1 problem if after starting timer if user change system time affect on timer. please inform me if there other possible way or solution.

timerinterval = setinterval(function() {     seconds=seconds+1;     if(seconds==60)     {         minutes=minutes+1;         if(minutes==60)         {             minutes=0;             hours=hours+1;         }                                                        $("#task"+adata['taskid']).html(("0" + hours).slice(-2)+":"+("0" + minutes).slice(-2));         seconds=0;     } },1000); 

try settimeout instead of setinterval

setinterval not prioritize calling function depending on browser load. have gone through same problem , resolved using settimeout


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -