summaryrefslogtreecommitdiff
path: root/js/codeq/comms.js
diff options
context:
space:
mode:
authorAleš Smodiš <aless@guru.si>2015-09-22 09:35:39 +0200
committerAleš Smodiš <aless@guru.si>2015-09-22 09:35:39 +0200
commit20a9bac2cb976ea385f8c3bb530e2d9ae2972e71 (patch)
treed672303272134f3dde02fd8cb78bfe9d020b3fa4 /js/codeq/comms.js
parentcee672f22d516ecc73f84a3dbe01328883a2a47d (diff)
Bugfix python terminal: unregister terminal_output on exit, declare the "lines" variable.
Diffstat (limited to 'js/codeq/comms.js')
-rw-r--r--js/codeq/comms.js21
1 files changed, 14 insertions, 7 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;
}
}
}