-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
33 lines (30 loc) · 743 Bytes
/
test.js
File metadata and controls
33 lines (30 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// from client
str = '{"sessionId":"7116154658142477","data":{"type":"string","color":"red","data":"aa"}}';
console.log(JSON.parse(str));
console.log(typeof JSON.parse(str));
var msg = {"type" : "string",
"color" : "red",
"data" : "1"};
function msgToJsonString(msg) {
return '{"type":"'+msg.type +'",'+
'"color":"'+msg.color +'",'+
'"data":"'+msg.data +'"}';
}
//j = {x:1, y:2,action:'mousemove'};
//typeof JSON.stringify(j);
//
//try {
// typeof JSON.parse('{"x":1, "y":2,"action":"mousemove"}');
//} catch (e) {
// console.log(__line+e.message);
//}
//
//
//js = [];
//js.push(j);
//js.push(j);
//
//console.log(js.length);
//messages = [];
//
//messages.push({ "sessionId" : 1});