| | |
| | | import Device from "./Device"; |
| | | import Settings from "./settings"; |
| | | import * as Http from './http'; |
| | | import WebSocketClient from './websocket' |
| | | |
| | | let player; |
| | | let websocket; |
| | | |
| | | const Map = () => { |
| | | const notify = useNotification(); |
| | |
| | | Tool.setMapContainer(player.mapContainer); |
| | | Tool.setThemeMode(themeMode); |
| | | Http.setNotify(notify); |
| | | websocket = new WebSocketClient('/ws/map/websocket'); |
| | | |
| | | await Http.fetchMapData(0); |
| | | // websocket.connect(); |
| | | // websocket.onMessage = (data) => { |
| | | // Tool.updateMapStatusInRealTime(data, () => curFloorRef.current, setCurSPrite); |
| | | // } |
| | | |
| | | } |
| | | initialize(); |
| | |
| | | notify('Welcome to Rcs', 'info'); |
| | | |
| | | return () => { |
| | | if (websocket) { |
| | | websocket.onMessage = () => { } |
| | | websocket.close(); |
| | | } |
| | | player.destroy(); |
| | | window.removeEventListener('resize', handleResize); |
| | | Tool.patchRaLayout(''); |