You can use window.after() . It guarantees a call of the function specified by you approximately in the set number of milliseconds. Inside the function, you check if another call is needed, and if you need it, you schedule it by calling after() again.