public/js/fingerpoken.js in fingerpoken-0.2.20101216024109 vs public/js/fingerpoken.js in fingerpoken-0.2.20101217123250
- old
+ new
@@ -27,10 +27,21 @@
scroll: {
y: 0,
}
};
+ state.message_callback = function(request) {
+ action = request["action"];
+ switch (action) {
+ case "status":
+ //$("#area").html("<h1 class='status'>" + request["status"] + "</h1>");
+ /* Use eval to do unicode escaping */
+ $("#area").html("<h1 class='status'>" + eval("\"" + request["status"] + "\"") + "</h1>");
+ break;
+ }
+ };
+
/* Sync configuration elements */
/* Mouse movement */
console.log(config("fingerpoken/mouse/movement"));
$("input[name = \"mouse-config\"]")
@@ -74,9 +85,14 @@
websocket.onclose = function(event) {
status.html("Closed, trying to reopen.");
setTimeout(function() {
connect(state);
}, 1000);
+ }
+
+ websocket.onmessage = function(event) {
+ var request = JSON.parse(event.data);
+ state.message_callback(request)
}
state.websocket = websocket;
}