Cesium Clock

Hi Cesium Dev Team,

I need to call a function for every 5 seconds based on condition and I need to stop it when ever I want. I can able to do it with java script setInterval. Can we do the same using Cesium clock? Need your guidance on this. If you share any sample piece of code that would be great.

Thanks in advance,
Gowtham.

Well I’m not Dev Team, but perhaps this would help (change comment psuedo code into real code.) It does check every tick though, I don’t know if there’s something equivalent to viewer.clock.onFiveSeconds.addEventListener

viewer.clock.onTick.addEventListener(function(clock)

{

//if (active&&(currentTime > lastExecutedTime + 5)) {lastExecutedTime=currentTime;if(myCondition()){doStuff();}}

});