summaryrefslogtreecommitdiff
path: root/js/python.js
diff options
context:
space:
mode:
authorAleš Smodiš <aless@guru.si>2015-09-15 20:06:01 +0200
committerAleš Smodiš <aless@guru.si>2015-09-15 20:06:01 +0200
commit3c02044761366fe474c7bf8cb5ba7307960c788c (patch)
tree9a894b324bc75ab6734a264961b2b16f9effd272 /js/python.js
parent6bb35042ef6fb19d9af5ee874de9da2816cbc5d7 (diff)
Prolog handler now uses CodeQ terminal.
Diffstat (limited to 'js/python.js')
-rw-r--r--js/python.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/js/python.js b/js/python.js
index d16cc72..82423c6 100644
--- a/js/python.js
+++ b/js/python.js
@@ -48,11 +48,11 @@
return terminal;
};
- var makeActivityHandler = function (editor) {
+ var makeActivityHandler = function (editor, problem_id) {
var lastActivityMillis = Date.now(),
deltaActivityMillis = function deltaActivityMillisFunc () {
var now = Date.now(),
- dt = Math.max(0, Math.min(30000, now - lastActivityMillis)); // 0 sec <= dt <= 30 sec
+ dt = now - lastActivityMillis;
lastActivityMillis = now;
return dt;
},
@@ -62,7 +62,7 @@
var promise;
ts = null;
if (queue.length === 0) return Q(true);
- promise = codeq.comms.sendActivity(queue, editor.getDoc().getValue());
+ promise = codeq.comms.sendActivity(queue, editor.getDoc().getValue(), problem_id);
queue.length = 0;
return promise;
},
@@ -111,7 +111,7 @@
jqConsole = $('#console'),
jqHints = $('#info'),
editor = CodeMirror(jqEditor[0], { cursorHeight: 0.85, lineNumbers: true, matchBrackets: true, mode: 'python' }),
- activityHandler = makeActivityHandler(editor),
+ activityHandler = makeActivityHandler(editor, problem.id),
terminal = makePythonTerminalHandler(jqConsole, editor, problem.id, activityHandler),
/** Object.<string, HintDefinition> */
@@ -248,6 +248,7 @@
var handler = {
destroy: function () {
+ terminal.destroy();
jqDescription.empty();
jqEditor.empty(); // TODO: perhaps you do not want to "free" the editor, just empty it
jqConsole.empty(); // TODO: the same with the console