mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-07-02 06:06:24 +00:00
Make type hierarchy from messages
This commit is contained in:
@ -7,6 +7,7 @@ import { ConsoleCommand } from '../message.types/console.command';
|
||||
import { config } from '../config';
|
||||
import { ProcessLogService } from '../services/processlog.service';
|
||||
import { LogMessage } from '../message.types/log.message';
|
||||
import { CommandMessage } from '../message.types/command.message';
|
||||
|
||||
@Component({
|
||||
selector: 'app-console',
|
||||
@ -29,7 +30,7 @@ export class ConsoleComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.webSocketService.connect();
|
||||
this.webSocketService.observeKey<ConsoleCommand>('console').subscribe(
|
||||
this.webSocketService.observeKey<CommandMessage>('console').subscribe(
|
||||
(event) => this.command_handlers[event.data.command](event.data)
|
||||
);
|
||||
this.processLogService.newLogs.subscribe((data) => this.newLogsHandler(data));
|
||||
@ -39,7 +40,7 @@ export class ConsoleComponent implements OnInit {
|
||||
this.setContent(data.content);
|
||||
}
|
||||
|
||||
readHandler(data: ConsoleCommand) {
|
||||
readHandler(data: CommandMessage) {
|
||||
this.sendContent(this.console_content);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user