Merge pull request #2731 from vidartf/comm-buffers

Add buffers argument to comm open/close
This commit is contained in:
Grant Nestor 2017-08-07 16:40:24 -04:00 committed by GitHub
commit 7dc9439af7

View File

@ -30,8 +30,8 @@ define([
kernel.register_iopub_handler(msg_type, $.proxy(this[msg_type], this));
}
};
CommManager.prototype.new_comm = function (target_name, data, callbacks, metadata, comm_id) {
CommManager.prototype.new_comm = function (target_name, data, callbacks, metadata, comm_id, buffers) {
/**
* Create a new Comm, register it, and open its Kernel-side counterpart
* Mimics the auto-registration in `Comm.__init__` in the Jupyter Comm.
@ -40,7 +40,7 @@ define([
*/
var comm = new Comm(target_name, comm_id);
this.register_comm(comm);
comm.open(data, callbacks, metadata);
comm.open(data, callbacks, metadata, buffers);
return comm;
};
@ -147,13 +147,13 @@ define([
};
// methods for sending messages
Comm.prototype.open = function (data, callbacks, metadata) {
Comm.prototype.open = function (data, callbacks, metadata, buffers) {
var content = {
comm_id : this.comm_id,
target_name : this.target_name,
data : data || {},
};
return this.kernel.send_shell_message("comm_open", content, callbacks, metadata);
return this.kernel.send_shell_message("comm_open", content, callbacks, metadata, buffers);
};
Comm.prototype.send = function (data, callbacks, metadata, buffers) {
@ -163,13 +163,13 @@ define([
};
return this.kernel.send_shell_message("comm_msg", content, callbacks, metadata, buffers);
};
Comm.prototype.close = function (data, callbacks, metadata) {
Comm.prototype.close = function (data, callbacks, metadata, buffers) {
var content = {
comm_id : this.comm_id,
data : data || {},
};
return this.kernel.send_shell_message("comm_close", content, callbacks, metadata);
return this.kernel.send_shell_message("comm_close", content, callbacks, metadata, buffers);
};
// methods for registering callbacks for incoming messages