|
|
|
@ -140,6 +140,10 @@ export class EditorComponent {
|
|
|
|
|
private client: WebSocket | undefined;
|
|
|
|
|
@Input()
|
|
|
|
|
set idRoom(idRoom: string) {
|
|
|
|
|
if( idRoom === undefined){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.client = new WebSocket(`ws://127.0.0.1:3000/live/${idRoom}`);
|
|
|
|
|
this.client.addEventListener('open', async () => {
|
|
|
|
|
let conn = new Connection(this.client!);
|
|
|
|
@ -161,7 +165,8 @@ export class EditorComponent {
|
|
|
|
|
constructor(
|
|
|
|
|
private router: Router,
|
|
|
|
|
private backendService: BackendService
|
|
|
|
|
) {}
|
|
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Efface le contenu de l'éditeur
|
|
|
|
|
clear(): void {
|
|
|
|
@ -169,7 +174,7 @@ export class EditorComponent {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async onCreateRoomButtonClicked() {
|
|
|
|
|
const idRoom = await this.backendService.createRoom();
|
|
|
|
|
const idRoom = await this.backendService.createRoom(this.editorContent);
|
|
|
|
|
await this.router.navigate([`./editor-live/${idRoom}`]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|