MCPcopy
hub / github.com/lektor/lektor / onInterval

Function onInterval

frontend/js/components/ServerStatus.tsx:14–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12
13 useEffect(() => {
14 const onInterval = () => {
15 get("/ping", null).then(
16 ({ project_id }) => {
17 setState(({ projectId }) =>
18 projectId === null
19 ? { projectId: project_id, serverIsUp: true }
20 : { projectId, serverIsUp: projectId === project_id }
21 );
22 },
23 () => {
24 setState((s) => ({ ...s, serverIsUp: false }));
25 }
26 );
27 };
28 const id = window.setInterval(onInterval, 2000);
29 return () => window.clearInterval(id);
30 }, []);

Callers

nothing calls this directly

Calls 1

getFunction · 0.90

Tested by

no test coverage detected