when (x==0) { /*do stuff*/ }
creates an event which will do nothing at first but keep checking the condition until it is met, and then runs once. Alternatively, on(signal) { /*do stuff*/ }
, alert(signal);
causes everything waiting for signal
to execute.