summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/codeq/comms.js13
-rw-r--r--js/codeq/prolog.js3
-rw-r--r--js/codeq/python.js9
-rw-r--r--js/codeq/robot.js3
4 files changed, 25 insertions, 3 deletions
diff --git a/js/codeq/comms.js b/js/codeq/comms.js
index d7d0935..ad2376e 100644
--- a/js/codeq/comms.js
+++ b/js/codeq/comms.js
@@ -348,6 +348,19 @@
});
},
+ loadProblem: function commsLoadProblem (problem_id) {
+ return this.send({
+ 'action': 'load_problem',
+ 'problem_id': problem_id
+ });
+ },
+
+ endProblem: function commsLoadProblem (problem_id) {
+ return this.send({
+ 'action': 'end_problem'
+ });
+ },
+
'on': function (event, handler) {
var handlers = requestHandlers[event],
N, i;
diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js
index 017dee2..a42bfc3 100644
--- a/js/codeq/prolog.js
+++ b/js/codeq/prolog.js
@@ -344,8 +344,11 @@
.done();
});
+ codeq.comms.loadProblem(problemDef.id).done();
+
return {
destroy: function () {
+ codeq.comms.endProblem().done();
$('#screen_prolog .title').text('');//empty the title text
jqAllButtons.off();
editor.off('change');
diff --git a/js/codeq/python.js b/js/codeq/python.js
index 49b6ccf..214b249 100644
--- a/js/codeq/python.js
+++ b/js/codeq/python.js
@@ -309,12 +309,15 @@
});
// TODO first line of interpreter output is buffered without this, why?
- codeq.comms.sendPythonPush({
- 'text': ''
- });
+// codeq.comms.sendPythonPush({
+// 'text': ''
+// });
+
+ codeq.comms.loadProblem(problemDef.id).done();
return {
destroy: function () {
+ codeq.comms.endProblem().done();
$('#screen_python .title').text('');//empty the title text
jqAllButtons.off();
editor.off('change');
diff --git a/js/codeq/robot.js b/js/codeq/robot.js
index 2545f1e..c2d23e1 100644
--- a/js/codeq/robot.js
+++ b/js/codeq/robot.js
@@ -278,8 +278,11 @@
});
});
+ codeq.comms.loadProblem(problemDef.id).done();
+
return {
destroy: function () {
+ codeq.comms.endProblem().done();
$('#screen_robot .title').text('');//empty the title text
jqAllButtons.off();
editor.off('change');