t = TrafficLight(); b = Button(); b.onclick(function () { print("your time was " + (now()-start) + "ms"); }) go = function () { print("click!"); t.green(); start = now(); } setTimeout(go, Math.random() * 10000); print("get ready...");
Output