Slide 23
Slide 23 text
class Message {
private state: MessageState;
constructor(
private sending: boolean,
private loading: boolean,
private editing: boolean,
private deleted: boolean,
) {
this.state = new MessageState(true, false, false,
false);
}
canEdit(): boolean {
return this.state.match({
"sending": () => false,
"loading": () => false,
"editing": () => true,
"deleted": () => false,
});
}
}