forked from snxraven/LinkUp-P2P-Chat
22 lines
521 B
JavaScript
22 lines
521 B
JavaScript
|
class Message {
|
||
|
constructor(messageType, peerName, peerAvatar, topic, timestamp) {
|
||
|
this.messageType = messageType;
|
||
|
this.peerName = peerName;
|
||
|
this.peerAvatar = peerAvatar;
|
||
|
this.topic = topic;
|
||
|
this.timestamp = timestamp;
|
||
|
}
|
||
|
|
||
|
toJson() {
|
||
|
return {
|
||
|
type: this.messageType,
|
||
|
name: this.peerName,
|
||
|
avatar: this.peerAvatar,
|
||
|
topic: this.topic,
|
||
|
timestamp: this.timestamp
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default Message;
|