mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-01-16 03:11:56 +00:00
Clean up WebIDE component's event handlers
This commit is contained in:
parent
4faffe1f79
commit
1c445deb88
@ -1,4 +1,4 @@
|
||||
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
||||
import { ChangeDetectorRef, Component, NgZone, OnInit } from '@angular/core';
|
||||
|
||||
import * as brace from 'brace';
|
||||
import 'brace/ext/modelist';
|
||||
@ -47,31 +47,31 @@ export class WebideComponent implements OnInit {
|
||||
|
||||
subscribeWS() {
|
||||
this.webSocketService.observeAnchor<SourceCode>(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';
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user