mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
hook up output for comm messages
This commit is contained in:
parent
3d3c3fd504
commit
f833b1ca03
@ -97,35 +97,35 @@ var IPython = (function (IPython) {
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
var Comm = function (comm_id, target) {
|
var Comm = function (comm_id, target) {
|
||||||
this.comm_id = comm_id;
|
this.comm_id = comm_id || new IPython.utils.uuid();
|
||||||
this.target = target || 'comm';
|
this.target = target || 'comm';
|
||||||
this._msg_callback = this._open_callback = this._close_callback = null;
|
this._msg_callback = this._open_callback = this._close_callback = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
// methods for sending messages
|
// methods for sending messages
|
||||||
Comm.prototype.open = function (data) {
|
Comm.prototype.open = function (data, callbacks) {
|
||||||
var content = {
|
var content = {
|
||||||
comm_id : this.comm_id,
|
comm_id : this.comm_id,
|
||||||
target : this.target,
|
target : this.target,
|
||||||
data : data || {},
|
data : data || {},
|
||||||
};
|
};
|
||||||
this.kernel.send_shell_message("comm_open", content);
|
return this.kernel.send_shell_message("comm_open", content, callbacks);
|
||||||
};
|
};
|
||||||
|
|
||||||
Comm.prototype.send = function (data) {
|
Comm.prototype.send = function (data, callbacks) {
|
||||||
var content = {
|
var content = {
|
||||||
comm_id : this.comm_id,
|
comm_id : this.comm_id,
|
||||||
data : data || {},
|
data : data || {},
|
||||||
};
|
};
|
||||||
return this.kernel.send_shell_message("comm_msg", content);
|
return this.kernel.send_shell_message("comm_msg", content, callbacks);
|
||||||
};
|
};
|
||||||
|
|
||||||
Comm.prototype.close = function (data) {
|
Comm.prototype.close = function (data, callbacks) {
|
||||||
var content = {
|
var content = {
|
||||||
comm_id : this.comm_id,
|
comm_id : this.comm_id,
|
||||||
data : data || {},
|
data : data || {},
|
||||||
};
|
};
|
||||||
return this.kernel.send_shell_message("comm_close", content);
|
return this.kernel.send_shell_message("comm_close", content, callbacks);
|
||||||
};
|
};
|
||||||
|
|
||||||
// methods for registering callbacks for incoming messages
|
// methods for registering callbacks for incoming messages
|
||||||
|
Loading…
Reference in New Issue
Block a user