13
0

WebSockets: make Message.fromJsonText() a ES6 static method

This commit is contained in:
Luciano Iam 2020-04-12 12:19:11 +02:00 committed by Robin Gareus
parent feeda2c19d
commit 2b8e9ceb89
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -82,6 +82,11 @@ export class Message {
}
}
static fromJsonText (jsonText) {
let rawMsg = JSON.parse(jsonText);
return new Message(rawMsg.node, rawMsg.addr || [], rawMsg.val);
}
toJsonText () {
let val = [];
@ -107,8 +112,3 @@ export class Message {
}
}
Message.fromJsonText = (jsonText) => {
let rawMsg = JSON.parse(jsonText);
return new Message(rawMsg.node, rawMsg.addr || [], rawMsg.val);
};