summaryrefslogtreecommitdiff
path: root/webcards/scripts/socket/message.js
diff options
context:
space:
mode:
Diffstat (limited to 'webcards/scripts/socket/message.js')
-rw-r--r--webcards/scripts/socket/message.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/webcards/scripts/socket/message.js b/webcards/scripts/socket/message.js
index 5e821c4..044027d 100644
--- a/webcards/scripts/socket/message.js
+++ b/webcards/scripts/socket/message.js
@@ -1,14 +1,18 @@
-function Message(type, data){
- this.t = type;
- this.d = data;
-}
+'use strict';
+
+class Message{
+ constructor (type, data)
+ {
+ this.t = type;
+ this.d = data;
+ }
-Message.prototype = {
- stringify: function(){
+ stringify ()
+ {
var dat = this.d
if(typeof dat !== "string"){
dat = JSON.stringify(dat);
}
return JSON.stringify({type: this.t, data: dat});
}
-};
+}