reloadをinject経由からuseIntervalへ変更
This commit is contained in:
@@ -110,13 +110,6 @@ export const injectJavascriptData: InjectJavascriptData = (
|
||||
setStrings();
|
||||
}catch(error){}
|
||||
};
|
||||
const useAutoReload = () =>{
|
||||
try{
|
||||
setReload();
|
||||
}catch(error){}
|
||||
setTimeout(useAutoReload, 10000);
|
||||
}
|
||||
useAutoReload();
|
||||
`;
|
||||
// 左か右かを判定してアイコンを設置する
|
||||
const trainIcon = `
|
||||
|
@@ -88,17 +88,20 @@ export const CurrentTrainProvider:FC<props> = ({ children }) => {
|
||||
);
|
||||
inject(script);
|
||||
}
|
||||
else{
|
||||
inject(`setReload()`);
|
||||
}
|
||||
},
|
||||
5000, //60000,
|
||||
false
|
||||
10000, //60000,
|
||||
true
|
||||
);
|
||||
useEffect(() => {
|
||||
if (fixedPosition) {
|
||||
setIntervalState.start();
|
||||
} else {
|
||||
setIntervalState.stop();
|
||||
}
|
||||
}, [fixedPosition]);
|
||||
// useEffect(() => {
|
||||
// if (fixedPosition) {
|
||||
// setIntervalState.start();
|
||||
// } else {
|
||||
// setIntervalState.stop();
|
||||
// }
|
||||
// }, [fixedPosition]);
|
||||
|
||||
type getPositionFuncType = (currentTrainData: trainDataType) => string[] | undefined;
|
||||
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 (
|
||||
|
Reference in New Issue
Block a user