Bug correction: message hooks should be applied to children messages too

This commit is contained in:
Ophir LOJKINE 2013-12-09 23:08:59 +01:00
parent 8a3bd2349e
commit 43eb94e48f
2 changed files with 7 additions and 3 deletions

View file

@ -28,7 +28,9 @@ var Tools = {};
Tools.board = document.getElementById("board");
Tools.svg = document.getElementById("canvas");
Tools.socket = io.connect('');
Tools.socket = io.connect('', {
"reconnection delay" : 1, //Make the xhr connections as fast as possible
});
Tools.curTool = null;
//Get the board as soon as the page is loaded
@ -158,13 +160,15 @@ Tools.pendingMessages = {};
//Receive draw instructions from the server
Tools.socket.on("broadcast", function (message){
//Check if the message is in the expected format
Tools.applyHooks(Tools.messageHooks, message);
if (message.tool) {
var tool = Tools.list[message.tool];
if (tool) {
Tools.applyHooks(Tools.messageHooks, message);
tool.draw(message, false); //draw the received data
if (message._children) {
for (var i=0; i<message._children.length; i++) {
//Apply hooks on children too
Tools.applyHooks(Tools.messageHooks, message._children[i]);
tool.draw(message._children[i]);
}
}

View file

@ -3,7 +3,7 @@
"collaborative",
"whiteboard"
],
"version": "0.2.1-6",
"version": "0.2.1-8",
"dependencies": {
"node-static": "0.7.x",
"socket.io": "0.9.x",