1 sec refresh Interval for a 5 sec task

I’m having the same issue, where I’m triggering a callback once per second, but they seem to be piling up in the browser and eventually crashing the app. Two questions:

  1. how can I effectively delay the start of the interval callback until the page that finished its initial load of the layout (most of the piling up happens at initial page load)
  2. I ideally want the callback to fire once per second, (the callback usually runs in a few hundred milliseconds so this should be possible, but it sometimes takes longer). Can I make sure that the next instance doesn’t trigger until the previous one has finished somehow?
1 Like