From f833b1ca030a6bb96e6306679070f4425c8db8a4 Mon Sep 17 00:00:00 2001 From: MinRK Date: Thu, 19 Sep 2013 16:16:40 -0700 Subject: [PATCH] hook up output for comm messages --- IPython/html/static/notebook/js/comm.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/IPython/html/static/notebook/js/comm.js b/IPython/html/static/notebook/js/comm.js index 6969ef8e5..38fafa870 100644 --- a/IPython/html/static/notebook/js/comm.js +++ b/IPython/html/static/notebook/js/comm.js @@ -97,35 +97,35 @@ var IPython = (function (IPython) { //----------------------------------------------------------------------- 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._msg_callback = this._open_callback = this._close_callback = null; }; // methods for sending messages - Comm.prototype.open = function (data) { + Comm.prototype.open = function (data, callbacks) { var content = { comm_id : this.comm_id, target : this.target, 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 = { comm_id : this.comm_id, 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 = { comm_id : this.comm_id, 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 @@ -144,7 +144,7 @@ var IPython = (function (IPython) { Comm.prototype.on_close = function (callback) { this._register_callback('close', callback); }; - + // methods for handling incoming messages Comm.prototype._maybe_callback = function (key, msg) { @@ -166,7 +166,7 @@ var IPython = (function (IPython) { IPython.CommManager = CommManager; IPython.Comm = Comm; - + return IPython; }(IPython));