diff options
Diffstat (limited to 'js/codeq/robot.js')
-rw-r--r-- | js/codeq/robot.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/js/codeq/robot.js b/js/codeq/robot.js index 0a62a2a..c716be8 100644 --- a/js/codeq/robot.js +++ b/js/codeq/robot.js @@ -196,6 +196,7 @@ }); jqBtnPlan.on('click', function () { + activityHandler.queueTrace({'typ': 'plan'}); if (!hinter.planNext()) { jqBtnPlan.prop('disabled', true).blur(); } @@ -209,6 +210,7 @@ }) .then(function (data) { if (data.code === 0) { + activityHandler.queueTrace({'typ': 'hint', 'feedback': data.hints}); hinter.handle(data.hints); } else { @@ -219,18 +221,17 @@ .done(); }); jqBtnRun.on('click', function () { - var url = 'http://' + $('#robot_ip').val() + ':8000/run', - doc = editor.getDoc(); - - socket.send(JSON.stringify({action: 'run', program: doc.getValue()})); + var program = editor.getDoc().getValue(); + activityHandler.queueTrace({'typ': 'robot_run', 'program': program}); + socket.send(JSON.stringify({action: 'run', program: program})); }); jqBtnStop.on('click', function () { - var url = 'http://' + $('#robot_ip').val() + ':8000/stop'; - + activityHandler.queueTrace({'typ': 'robot_stop'}); socket.send(JSON.stringify({action: 'stop'})); }); codeq.comms.loadProblem(problemDef.id).done(); + activityHandler.queueTrace({'typ': 'open', 'time': Date.now()}); return { destroy: function () { @@ -250,6 +251,7 @@ $('#screen_robot .title').text('');//empty the title text jqAllButtons.off(); editor.off('change'); + activityHandler.queueTrace({'typ': 'close'}); activityHandler.flush(); hinter.destroy(); jqDescriptionContent.empty(); |