How to sleep for a seconds in C3 javascript?

#1

I would like to check for the status some call made on a separate system, I can’t make a callback, how do I do a busy loop and just sleep for some time?

#2

java.lang.Thread.sleep(numberOfMilliseconds);

#3

A (potentially) better solution (because i do not recommend accessing java from javascript directly) is

var isReady = false;
do {
isReady = checkOtherSystem();
} while (!isReady)

Ideally you could find some sort of callback mechanism to avoid occupying a thread while you wait.