diff options
author | Thomas F. K. Jorna <[email protected]> | 2021-07-22 18:37:41 +0200 |
---|---|---|
committer | Thomas F. K. Jorna <[email protected]> | 2021-07-22 18:37:41 +0200 |
commit | 1d66292f8f16af75ac878a94a87abf9e56ee38ea (patch) | |
tree | 0e48f3d6104d97f7482a7435bd5fb4349f9213fd /pages | |
parent | 83ebd530f2137bd0f282e0e27bfc58aac1bf2341 (diff) |
added eventsource node tracking
Diffstat (limited to 'pages')
-rw-r--r-- | pages/index.tsx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pages/index.tsx b/pages/index.tsx index 356f5bb..31cc0ba 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -139,11 +139,19 @@ export function GraphPage() { const [physics, setPhysics] = usePersistantState('physics', initialPhysics) const [theme, setTheme] = useState(initialTheme) const [graphData, setGraphData] = useState<GraphData | null>(null) + const [emacsNode, setEmacsNode] = useState<string>('') const nodeByIdRef = useRef<NodeById>({}) const linksByNodeIdRef = useRef<LinksByNodeId>({}) useEffect(() => { + const trackEmacs = new EventSource('http://127.0.0.1:35901/current-node-id') + + trackEmacs.addEventListener('message', (e) => { + setEmacsNode(e.data) + console.log(e.data) + console.log(emacsNode) + }) fetch('http://localhost:35901/theme') .then((res) => res.json()) .then((emacsTheme) => { |