• Can you show a little bit more of the code? I wonder about the connect being some async/callback thing that messes with you... Worst case - comes push to shove - it may be that the (async) code executing 'in' connect(... makes the JS interpreter loose the context and returns unable to match the break with the switch it looks to be in... (if we can trust the console output - time sync correctly...). Try this far shot by wrapping connect() into a setTimeout(...: setTimeout(connect,1); (connect() must be a globally / level 0 defined function of yours, is it?).

    Btw, you can simply say if (timer) timer = clearInterval(timer); (and conversely if (!timer) { ... - in line 15) with globally declaring var timer;.

    What are you using the timer for? ...update the display every second?

About

Avatar for allObjects @allObjects started