rt-sim-training-client/static/workertest/passsimulation/station.js

26 lines
317 B
JavaScript
Raw Normal View History

2020-05-28 13:39:41 +08:00
var i=0;
var update = null;
function timedCount(){
onmessage = (e) => {
if(e.data == "on"){
console.log("on");
update = setInterval("stationupdate()", 2000);
2020-05-28 13:39:41 +08:00
}
if(e.data == "off"){
clearInterval(update);
}
}
}
function stationupdate(){
postMessage("up");
}
timedCount();