feat(mobx): add sync back (do not look at the code)

This commit is contained in:
Paul
2021-12-24 02:05:18 +00:00
parent cc0e45526c
commit e89bbb7455
18 changed files with 341 additions and 166 deletions

View File

@@ -1,6 +1,6 @@
import { Wrench } from "@styled-icons/boxicons-solid";
import { useContext, useState } from "preact/hooks";
import { useContext, useEffect, useState } from "preact/hooks";
import PaintCounter from "../../lib/PaintCounter";
import { TextReact } from "../../lib/i18n";
@@ -16,10 +16,14 @@ export default function Developer() {
const userPermission = client.user!.permission;
const [ping, setPing] = useState<undefined | number>(client.websocket.ping);
setInterval(
() => setPing(client.websocket.ping),
client.options.heartbeat * 1e3,
);
useEffect(() => {
const timer = setInterval(
() => setPing(client.websocket.ping),
client.options.heartbeat * 1e3,
);
return () => clearInterval(timer);
}, []);
return (
<div>