blob: f1beda3e92ebf7c5b52af633539f7631570dc65a [file] [log] [blame] [edit]
import { makeObservable, observable, action } from 'mobx';
export class Message {
static _nextId = 0;
id;
text;
author; // Person
timestamp;
static nextId() {
return Message._nextId++;
}
constructor(text, author) {
makeObservable(this, {
text: observable,
updateText: action,
});
this.id = Message.nextId();
this.text = text;
this.author = author;
this.timestamp = new Date();
}
updateText(text) {
this.text = text;
}
}