summaryrefslogtreecommitdiff
path: root/webcards/scripts/socket/message.js
diff options
context:
space:
mode:
authorKyle Gunger <corechg@gmail.com>2020-04-03 16:44:23 -0400
committerKyle Gunger <corechg@gmail.com>2020-04-03 16:44:23 -0400
commit1697da112a9b9f529fad2f54c62aecd7bbb614e6 (patch)
tree68c7cd383107e824953b6aa213d05d9a6842b73f /webcards/scripts/socket/message.js
parent3040a822085adeb9025ddc1a4573cf37cb37d377 (diff)
[WEBCARDS] Update some webcards stuff
Diffstat (limited to 'webcards/scripts/socket/message.js')
-rw-r--r--webcards/scripts/socket/message.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/webcards/scripts/socket/message.js b/webcards/scripts/socket/message.js
new file mode 100644
index 0000000..5e821c4
--- /dev/null
+++ b/webcards/scripts/socket/message.js
@@ -0,0 +1,14 @@
+function Message(type, data){
+ this.t = type;
+ this.d = data;
+}
+
+Message.prototype = {
+ stringify: function(){
+ var dat = this.d
+ if(typeof dat !== "string"){
+ dat = JSON.stringify(dat);
+ }
+ return JSON.stringify({type: this.t, data: dat});
+ }
+};