diff options
author | Kyle Gunger <corechg@gmail.com> | 2020-02-27 17:48:00 -0500 |
---|---|---|
committer | Kyle Gunger <corechg@gmail.com> | 2020-02-27 17:48:00 -0500 |
commit | ea8f308bc00330b5378eb2b8f16d9cc348719c9a (patch) | |
tree | 34a9074b4687beefd3bf046d68374ef307f178da /webcards/scripts/client/message.js | |
parent | 62cfd4f23993e04602aa15adf4fc71e6eb48c376 (diff) |
Init WebCards
Diffstat (limited to 'webcards/scripts/client/message.js')
-rw-r--r-- | webcards/scripts/client/message.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/webcards/scripts/client/message.js b/webcards/scripts/client/message.js new file mode 100644 index 0000000..5e821c4 --- /dev/null +++ b/webcards/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}); + } +}; |