mirror of
https://github.com/wassname/HackFlowy.git
synced 2026-07-05 17:20:05 +08:00
fixing deadLock on Browser Close
This commit is contained in:
+11
-3
@@ -54,6 +54,13 @@ module.exports = {
|
||||
getAndSendRevHistory(subRootId, socket);
|
||||
});
|
||||
|
||||
socket.on('disconnect', function(){
|
||||
console.log("DISCONNECT", socket.CUR_ID);
|
||||
if(!(socket.CUR_ID == undefined)){
|
||||
io.sockets.emit("blurred", [socket.CUR_ID, null]);
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
@@ -82,13 +89,13 @@ function attachLogInListeners(socket){
|
||||
});
|
||||
|
||||
//Used when a node is split...
|
||||
//Maybe set CurID
|
||||
socket.on("edit", function(data){
|
||||
var id = data[0];
|
||||
var newText = data[1];
|
||||
console.log("\n\n\n\n edit received:" + newText);
|
||||
Node.updateText(id, newText);
|
||||
socket.broadcast.emit("edit", [id, newText]);
|
||||
|
||||
socket.broadcast.emit("edit", [id, newText]);
|
||||
});
|
||||
|
||||
//This works for all ids except negative ids.
|
||||
@@ -96,11 +103,12 @@ function attachLogInListeners(socket){
|
||||
console.log("EDITING received!");
|
||||
console.log(data);
|
||||
socket.broadcast.emit("editing", data);
|
||||
socket.CUR_ID = data[0];
|
||||
});
|
||||
|
||||
|
||||
socket.on("blurred", function(data){
|
||||
console.log("BLURRED");
|
||||
console.log("BLURRED , CUR_ID", socket.CUR_ID);
|
||||
socket.broadcast.emit("blurred", data);
|
||||
|
||||
var id = data[0];
|
||||
|
||||
Reference in New Issue
Block a user