mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-04-03 10:12:41 +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.
|
// All Rights Reserved. See LICENSE file for details.
|
||||||
|
|
||||||
import { CommandMessage } from './command.message';
|
import { CommandMessage } from './command.message';
|
||||||
|
import { SetValueCommand } from './set.value.command';
|
||||||
|
|
||||||
export interface MessageControlCommand extends CommandMessage {
|
export interface MessagesControlCommand extends CommandMessage, SetValueCommand<boolean> {}
|
||||||
next_visibility?: boolean;
|
|
||||||
}
|
|
@ -6,7 +6,7 @@ import { MarkdownService } from '../services/markdown.service';
|
|||||||
import { WebSocketService } from '../services/websocket.service';
|
import { WebSocketService } from '../services/websocket.service';
|
||||||
|
|
||||||
import { MessagesMessage } from '../message.types/messages.message';
|
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 { config } from '../config';
|
||||||
import { CommandMessage } from '../message.types/command.message';
|
import { CommandMessage } from '../message.types/command.message';
|
||||||
|
|
||||||
@ -18,7 +18,9 @@ import { CommandMessage } from '../message.types/command.message';
|
|||||||
export class MessagesComponent implements OnInit {
|
export class MessagesComponent implements OnInit {
|
||||||
messages: MessagesMessage[] = [];
|
messages: MessagesMessage[] = [];
|
||||||
showNextButton: boolean = config.messages.showNextButton;
|
showNextButton: boolean = config.messages.showNextButton;
|
||||||
command_handlers = {'showbutton': this.showButtonHandler.bind(this)};
|
command_handlers = {
|
||||||
|
'showNextButton': this.showButtonHandler.bind(this)
|
||||||
|
};
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private markdownService: MarkdownService,
|
private markdownService: MarkdownService,
|
||||||
@ -44,8 +46,8 @@ export class MessagesComponent implements OnInit {
|
|||||||
return this.markdownService.convertToHtml(text);
|
return this.markdownService.convertToHtml(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
showButtonHandler(data: MessageControlCommand) {
|
showButtonHandler(data: MessagesControlCommand) {
|
||||||
this.showNextButton = data.next_visibility;
|
this.showNextButton = data.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
stepFSM() {
|
stepFSM() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user