generated from nim-od/softeer-mono-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from softeerbootcamp4th/main
[Deploy] 8.21 최종 테스트
- Loading branch information
Showing
8 changed files
with
130 additions
and
33 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
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
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
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,8 +1,14 @@ | ||
import { useEffect } from 'react'; | ||
import RealTimeChatting from 'src/components/chat/RealTimeChatting.tsx'; | ||
import useSocket from 'src/hooks/socket/index.ts'; | ||
|
||
function Review() { | ||
const { chatSocket } = useSocket(); | ||
useEffect(() => { | ||
if (chatSocket.isValid) { | ||
chatSocket.onRequestMessageHistory(); | ||
} | ||
}, [chatSocket.isValid]); | ||
return <RealTimeChatting chatSocket={chatSocket} />; | ||
} | ||
export default Review; |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class EventBus { | ||
private eventTarget = new EventTarget(); | ||
|
||
public on(event: string, callback: (event: Event) => void): void { | ||
this.eventTarget.addEventListener(event, callback); | ||
} | ||
|
||
public off(event: string, callback: (event: Event) => void): void { | ||
this.eventTarget.removeEventListener(event, callback); | ||
} | ||
|
||
public emit(event: string, detail: any): void { | ||
const customEvent = new CustomEvent(event, { detail }); | ||
this.eventTarget.dispatchEvent(customEvent); | ||
} | ||
} | ||
|
||
export const eventBus = new EventBus(); |
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
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
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