LEDVisionのリアルタイム動作化
This commit is contained in:
parent
6b54d01030
commit
db218609a8
@ -113,8 +113,11 @@ export default function LED_vision(props){
|
||||
};
|
||||
const trainTimeAndNumber = stationDiagram != null ? getTime() : null;
|
||||
useEffect(()=>{
|
||||
fetch("https://train.jr-shikoku.co.jp/g?arg1=train&arg2=train", HeaderConfig).then(response => response.json()).then(d=>d.map(x=>({num:x.TrainNum,delay:x.delay}))).then(d=>{
|
||||
setCurrentTrain(d)});
|
||||
const getCurrentTrain = () =>fetch("https://train.jr-shikoku.co.jp/g?arg1=train&arg2=train", HeaderConfig).then(response => response.json()).then(d=>d.map(x=>({num:x.TrainNum,delay:x.delay}))).then(d=>setCurrentTrain(d));
|
||||
getCurrentTrain();
|
||||
const currentTrainInterval = setInterval(()=>getCurrentTrain(),15000)
|
||||
return ()=>clearInterval(currentTrainInterval);
|
||||
|
||||
},[])
|
||||
|
||||
const filtering = d => currentTrain.map(m=>m.num).includes(d.train)
|
||||
|
Loading…
Reference in New Issue
Block a user