Moved sockets. Fixed sockets.

This commit is contained in:
Alexander Kastius
2016-08-17 17:25:27 +02:00
parent 97c1c5e455
commit aec7c593d8
6 changed files with 147 additions and 106 deletions

View File

@@ -16,6 +16,8 @@ CodeOceanEditorTurtle = {
},
handleTurtleCommand: function (msg) {
this.initTurtle();
this.showCanvas();
if (msg.action in this.turtlescreen) {
var result = this.turtlescreen[msg.action].apply(this.turtlescreen, msg.args);
this.websocket.send(JSON.stringify({cmd: 'result', 'result': result}));
@@ -26,6 +28,8 @@ CodeOceanEditorTurtle = {
},
handleTurtlebatchCommand: function (msg) {
this.initTurtle();
this.showCanvas();
for (var i = 0; i < msg.batch.length; i++) {
var cmd = msg.batch[i];
this.turtlescreen[cmd[0]].apply(this.turtlescreen, cmd[1]);