27 lines
727 B
JavaScript
27 lines
727 B
JavaScript
class FileMessage {
|
|
constructor(peerName, fileName, fileUrl, fileType, peerAvatar, topic, timestamp) {
|
|
this.peerName = peerName;
|
|
this.fileName = fileName;
|
|
this.fileUrl = fileUrl;
|
|
this.fileType = fileType;
|
|
this.peerAvatar = peerAvatar;
|
|
this.topic = topic;
|
|
this.timestamp = timestamp;
|
|
}
|
|
|
|
toJsonString() {
|
|
return JSON.stringify({
|
|
type: 'file',
|
|
name: this.peerName,
|
|
fileName: this.fileName,
|
|
fileUrl: this.fileUrl,
|
|
fileType: this.fileType,
|
|
avatar: this.peerAvatar,
|
|
topic: this.topic,
|
|
timestamp: this.timestamp,
|
|
});
|
|
}
|
|
}
|
|
|
|
export default FileMessage;
|