##// END OF EJS Templates
allow callbacks on status messages
MinRK -
Show More
@@ -481,12 +481,22 var IPython = (function (IPython) {
481 481
482 482 Kernel.prototype._handle_status_message = function (msg) {
483 483 var execution_state = msg.content.execution_state;
484 var parent_id = msg.parent_header.msg_id;
485
486 // dispatch status msg callbacks, if any
487 var callbacks = this.get_callbacks_for_msg(parent_id);
488 if (callbacks && callbacks.iopub && callbacks.iopub.status) {
489 try {
490 callbacks.iopub.status(msg);
491 } catch (e) {
492 console.log("Exception in status msg handler", e);
493 }
494 }
495
484 496 if (execution_state === 'busy') {
485 497 $([IPython.events]).trigger('status_busy.Kernel', {kernel: this});
486 498 } else if (execution_state === 'idle') {
487 // clear callbacks
488 var parent_id = msg.parent_header.msg_id;
489 var callbacks = this.get_callbacks_for_msg(parent_id);
499 // clear callbacks on idle, there can be no more
490 500 if (callbacks !== undefined) {
491 501 delete callbacks.iopub;
492 502 delete callbacks.input;
@@ -494,7 +504,7 var IPython = (function (IPython) {
494 504 this.clear_callbacks_for_msg(parent_id);
495 505 }
496 506 }
497
507 // trigger status_idle event
498 508 $([IPython.events]).trigger('status_idle.Kernel', {kernel: this});
499 509 } else if (execution_state === 'restarting') {
500 510 // autorestarting is distinct from restarting,
General Comments 0
You need to be logged in to leave comments. Login now