diff --git a/src/app/webide/source-code.ts b/src/app/webide/source-code.ts index e0610ef..2b49091 100644 --- a/src/app/webide/source-code.ts +++ b/src/app/webide/source-code.ts @@ -1,8 +1,6 @@ -export class SourceCode { - filename: string; - content: string; - language: string; - files: string[]; - saved: boolean; +export interface SourceCode { + filename?: string; + content?: string; + files?: string[]; command: string; } diff --git a/src/app/webide/webide.component.ts b/src/app/webide/webide.component.ts index e6e25fd..32e50fe 100644 --- a/src/app/webide/webide.component.ts +++ b/src/app/webide/webide.component.ts @@ -48,31 +48,31 @@ export class WebideComponent implements OnInit { subscribeWS() { this.webSocketService.observeAnchor(this.anchor_id).subscribe((event) => { - this.command_handlers[event.data.command](event); + this.command_handlers[event.data.command](event.data); this.changeDetectorRef.detectChanges(); }); } - updateFileData(event: any) { - this.filename = event.data.filename; - this.code = event.data.content; + updateFileData(data: SourceCode) { + this.filename = data.filename; + this.code = data.content; this.language = modelist.getModeForPath(this.filename).name; - this.files = event.data.files; + this.files = data.files; } - selectHandler(event: any) { - this.updateFileData(event); + selectHandler(data: SourceCode) { + this.updateFileData(data); } - reloadHandler(event: any) { + reloadHandler(data: SourceCode) { this.requestCode(); } - readHandler(event: any) { - this.updateFileData(event); + readHandler(data: SourceCode) { + this.updateFileData(data); } - writeHandler(event: any) { + writeHandler(data: SourceCode) { this.saveButtonState = 'SAVED'; }