Don't init twice

This commit is contained in:
NGnius (Graham) 2023-09-03 18:21:23 -04:00
parent f4a3f06aae
commit dd6672f9ba
2 changed files with 10 additions and 11 deletions

View file

@ -103,5 +103,3 @@ export async function getTemperature(): Promise<number> {
return (await FAN_CLIENT!.get_temperature(true))?? -273;
//return (await call_backend("get_temperature", []))[0];
}
initBackend();

View file

@ -305,16 +305,17 @@ const Content: VFC<{ serverAPI: ServerAPI }> = ({serverAPI}) => {
);
};
(async function(){
if (!usdplReady) {
await backend.initBackend();
usdplReady = true;
backend.getEnabled();
name = await backend.getName();
version = await backend.getVersion();
}
})();
export default definePlugin((serverApi: ServerAPI) => {
(async function(){
if (!usdplReady) {
await backend.initBackend();
usdplReady = true;
backend.getEnabled();
name = await backend.getName();
version = await backend.getVersion();
}
})();
let ico = <FaFan />;
let now = new Date();