-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ refactor : using action router and ws hook
- Loading branch information
1 parent
c7b5dbe
commit 192d9d0
Showing
1 changed file
with
26 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import ReactDOM from 'react-dom/client' | ||
import StreamDeckComponent from './StreamDeck' | ||
import './sdpi.css' | ||
window.connectElgatoStreamDeckSocket = (inPort: number, inUUID: string, inRegisterEvent: string, inInfo: string, inActionInfo: string) => { | ||
import './css/sdpi.css'; | ||
import ReactDOM from 'react-dom/client'; | ||
|
||
// - Components | ||
import RouterAction from './router'; | ||
|
||
// - Types | ||
import { ParsedProps } from './types/streamDeck'; | ||
|
||
// - Hooks | ||
import { WebSocketProvider } from './hooks/useWebSocket'; | ||
|
||
|
||
window.connectElgatoStreamDeckSocket = (inPort: string, inUUID: string, inRegisterEvent: string, inInfo: string, inActionInfo: string) => { | ||
const parsedProps: ParsedProps = { | ||
inPort: parseInt(inPort), | ||
inUUID, | ||
inRegisterEvent, | ||
inInfo: JSON.parse(inInfo), | ||
inActionInfo: JSON.parse(inActionInfo), | ||
}; | ||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<StreamDeckComponent | ||
inPort={inPort} | ||
inUUID={inUUID} | ||
inRegisterEvent={inRegisterEvent} | ||
inInfo={inInfo} | ||
inActionInfo={inActionInfo} | ||
/>, | ||
) | ||
} | ||
<WebSocketProvider props={parsedProps}> | ||
<RouterAction {...parsedProps} /> | ||
</WebSocketProvider> | ||
); | ||
}; |