-1

I want to run a function every 10th minute in an hour. So for 10AM, the events will fire exactly at:

10:00
10:10
10:20
10:30
10:40
10:50

I'm aware of setTimeout and setInterval, however:
1. They're never exact. They're sometimes early, or delayed. They also get effected by being out of focus.
2. I'm not sure how to make a system (as I mentioned above) that will work with timeouts or intervals. 3. Looking for the right way to do this.

I'm not looking for a timer, but a scheduler.

Any ideas are appreciated.

Mia
  • 6,220
  • 12
  • 47
  • 81

1 Answers1

0

I personally would use NodeJS or other sync solution. Easy way: http://www.webdesignerdepot.com/2013/06/how-to-build-a-realtime-jquery-plugin/

  • How would yo do that clientside? – Mia Jun 15 '15 at 23:26
  • I won't answer this, because this may get you in trouble. One of the coders rules - never trust clientside. I personally don't trust setInterval or setTimeout. What the sense? If clients browser did lag, then that's it - delay. –  Jun 15 '15 at 23:29
  • Well this is for a static webpage, no server side. In other words "trust" is not an issue. I just want this to work properly. – Mia Jun 15 '15 at 23:31
  • This is most accurate solution, I guess. https://github.com/mrchimp/tock Because it has self-correcting system inside. So, I would try to adapt this to your needs. –  Jun 15 '15 at 23:36