Hi, I need to perform a specific function every 0.5 seconds, but do not use setTimeout / setInterval. Tell me how to do this using Date.now ()
on js, thanks in advance
Hi, I need to perform a specific function every 0.5 seconds, but do not use setTimeout / setInterval. Tell me how to do this using Date.now ()
on js, thanks in advance
var interval = 500; //полсекунды var startDate = Date.now(); while (true) { var nowDate = Date.now(); if (nowDate-startDate >= interval) { startDate = nowDate; callSomeFunc(); } } Source: https://ru.stackoverflow.com/questions/601548/
All Articles