mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
Merge pull request #7087 from nheijermans/master
Enable the IPython Notebook to display messages from other clients.
This commit is contained in:
commit
27c90f1da3
@ -136,6 +136,7 @@ define([
|
||||
this._iopub_handlers = {};
|
||||
this.register_iopub_handler('status', $.proxy(this._handle_status_message, this));
|
||||
this.register_iopub_handler('clear_output', $.proxy(this._handle_clear_output, this));
|
||||
this.register_iopub_handler('execute_input', $.proxy(this._handle_input_message, this));
|
||||
|
||||
for (var i=0; i < output_msg_types.length; i++) {
|
||||
this.register_iopub_handler(output_msg_types[i], $.proxy(this._handle_output_message, this));
|
||||
@ -998,6 +999,9 @@ define([
|
||||
Kernel.prototype._handle_output_message = function (msg) {
|
||||
var callbacks = this.get_callbacks_for_msg(msg.parent_header.msg_id);
|
||||
if (!callbacks || !callbacks.iopub) {
|
||||
// The message came from another client. Let the UI decide what to
|
||||
// do with it.
|
||||
this.events.trigger('received_unsolicited_message.Kernel', msg);
|
||||
return;
|
||||
}
|
||||
var callback = callbacks.iopub.output;
|
||||
@ -1006,6 +1010,20 @@ define([
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle an input message (execute_input).
|
||||
*
|
||||
* @function _handle_input message
|
||||
*/
|
||||
Kernel.prototype._handle_input_message = function (msg) {
|
||||
var callbacks = this.get_callbacks_for_msg(msg.parent_header.msg_id);
|
||||
if (!callbacks) {
|
||||
// The message came from another client. Let the UI decide what to
|
||||
// do with it.
|
||||
this.events.trigger('received_unsolicited_message.Kernel', msg);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Dispatch IOPub messages to respective handlers. Each message
|
||||
* type should have a handler.
|
||||
|
Loading…
Reference in New Issue
Block a user