reloadをinject経由からuseIntervalへ変更
This commit is contained in:
@@ -110,13 +110,6 @@ export const injectJavascriptData: InjectJavascriptData = (
|
|||||||
setStrings();
|
setStrings();
|
||||||
}catch(error){}
|
}catch(error){}
|
||||||
};
|
};
|
||||||
const useAutoReload = () =>{
|
|
||||||
try{
|
|
||||||
setReload();
|
|
||||||
}catch(error){}
|
|
||||||
setTimeout(useAutoReload, 10000);
|
|
||||||
}
|
|
||||||
useAutoReload();
|
|
||||||
`;
|
`;
|
||||||
// 左か右かを判定してアイコンを設置する
|
// 左か右かを判定してアイコンを設置する
|
||||||
const trainIcon = `
|
const trainIcon = `
|
||||||
|
@@ -88,17 +88,20 @@ export const CurrentTrainProvider:FC<props> = ({ children }) => {
|
|||||||
);
|
);
|
||||||
inject(script);
|
inject(script);
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
inject(`setReload()`);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
5000, //60000,
|
10000, //60000,
|
||||||
false
|
true
|
||||||
);
|
);
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
if (fixedPosition) {
|
// if (fixedPosition) {
|
||||||
setIntervalState.start();
|
// setIntervalState.start();
|
||||||
} else {
|
// } else {
|
||||||
setIntervalState.stop();
|
// setIntervalState.stop();
|
||||||
}
|
// }
|
||||||
}, [fixedPosition]);
|
// }, [fixedPosition]);
|
||||||
|
|
||||||
type getPositionFuncType = (currentTrainData: trainDataType) => string[] | undefined;
|
type getPositionFuncType = (currentTrainData: trainDataType) => string[] | undefined;
|
||||||
const getPosition: getPositionFuncType = (currentTrainData) => {
|
const getPosition: getPositionFuncType = (currentTrainData) => {
|
||||||
|
@@ -122,7 +122,7 @@ export const StationListProvider: FC<Props> = ({ children }) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return `MoveDisplayStation('${bootStationList[0].line}_${bootStationList[0].station.MyStation}_${bootStationList[0].station.Station_JP}');document.getElementById("disp").insertAdjacentHTML("afterbegin", "<div />");`;
|
return `MoveDisplayStation('${bootStationList[0].line}_${bootStationList[0].station.MyStation}_${bootStationList[0].station.Station_JP}');document.getElementById("disp").insertAdjacentHTML("afterbegin", "<div />");setReload();`;
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Reference in New Issue
Block a user