mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2024-12-05 02:41:32 +00:00
Refactor Messages API with new types and conventions
This commit is contained in:
parent
2fdcea4af8
commit
c407ce1e96
@ -2,7 +2,6 @@
|
||||
// All Rights Reserved. See LICENSE file for details.
|
||||
|
||||
import { CommandMessage } from './command.message';
|
||||
import { SetValueCommand } from './set.value.command';
|
||||
|
||||
export interface MessageControlCommand extends CommandMessage {
|
||||
next_visibility?: boolean;
|
||||
}
|
||||
export interface MessagesControlCommand extends CommandMessage, SetValueCommand<boolean> {}
|
@ -6,7 +6,7 @@ import { MarkdownService } from '../services/markdown.service';
|
||||
import { WebSocketService } from '../services/websocket.service';
|
||||
|
||||
import { MessagesMessage } from '../message.types/messages.message';
|
||||
import { MessageControlCommand } from '../message.types/message.control.command';
|
||||
import { MessagesControlCommand } from '../message.types/messages.control.command';
|
||||
import { config } from '../config';
|
||||
import { CommandMessage } from '../message.types/command.message';
|
||||
|
||||
@ -18,7 +18,9 @@ import { CommandMessage } from '../message.types/command.message';
|
||||
export class MessagesComponent implements OnInit {
|
||||
messages: MessagesMessage[] = [];
|
||||
showNextButton: boolean = config.messages.showNextButton;
|
||||
command_handlers = {'showbutton': this.showButtonHandler.bind(this)};
|
||||
command_handlers = {
|
||||
'showNextButton': this.showButtonHandler.bind(this)
|
||||
};
|
||||
|
||||
constructor(
|
||||
private markdownService: MarkdownService,
|
||||
@ -44,8 +46,8 @@ export class MessagesComponent implements OnInit {
|
||||
return this.markdownService.convertToHtml(text);
|
||||
}
|
||||
|
||||
showButtonHandler(data: MessageControlCommand) {
|
||||
this.showNextButton = data.next_visibility;
|
||||
showButtonHandler(data: MessagesControlCommand) {
|
||||
this.showNextButton = data.value;
|
||||
}
|
||||
|
||||
stepFSM() {
|
||||
|
Loading…
Reference in New Issue
Block a user