diff options
-rw-r--r-- | js/codeq/comms.js | 21 | ||||
-rw-r--r-- | js/codeq/python.js | 5 |
2 files changed, 17 insertions, 9 deletions
diff --git a/js/codeq/comms.js b/js/codeq/comms.js index db9b7b5..9e69526 100644 --- a/js/codeq/comms.js +++ b/js/codeq/comms.js @@ -298,14 +298,21 @@ var handlers = requestHandlers[event], N, i; if (!handlers) return; // none registered - N = handlers.length; - for (i = 0; i < N; i++) { - if (handlers[i] === handler) { - handlers.splice(i, 1); - if (handlers.length === 0) { - delete requestHandlers[event]; + if (arguments.length == 1) { + // no handler specified -> remove all handlers for this event + delete requestHandlers[event]; + handlers.length = 0; + } + else { + N = handlers.length; + for (i = 0; i < N; i++) { + if (handlers[i] === handler) { + handlers.splice(i, 1); + if (handlers.length === 0) { + delete requestHandlers[event]; + } + return; } - return; } } } diff --git a/js/codeq/python.js b/js/codeq/python.js index 39077d8..e5b59c2 100644 --- a/js/codeq/python.js +++ b/js/codeq/python.js @@ -126,9 +126,9 @@ }; codeq.comms.on('terminal_output', function (data) { - var text = data.text; + var text = data.text, + lines = text.split('\n'); terminal.append(text, 'output'); - lines = text.split('\n'); terminal.leftmostCol = lines[lines.length-1].length; }); @@ -270,6 +270,7 @@ destroy: function () { jqAllButtons.off(); editor.off('change'); + codeq.comms.off('terminal_output'); // stop listening for the terminal events from server hinter.destroy(); terminal.destroy(); jqDescriptionContent.empty(); |