From 87ce9d1c162ac9606a9b4d817a5f3b486889a46f Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Thu, 27 Feb 2020 18:06:56 -0500 Subject: Initialize Client repo with predone work --- scripts/client/message.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 scripts/client/message.js (limited to 'scripts/client/message.js') diff --git a/scripts/client/message.js b/scripts/client/message.js new file mode 100644 index 0000000..5e821c4 --- /dev/null +++ b/scripts/client/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}); + } +}; -- cgit v1.2.3