Show More
@@ -102,29 +102,29 b' var IPython = (function (IPython) {' | |||
|
102 | 102 | }; |
|
103 | 103 | |
|
104 | 104 | // methods for sending messages |
|
105 | Comm.prototype.open = function (data, callbacks) { | |
|
105 | Comm.prototype.open = function (data, callbacks, metadata) { | |
|
106 | 106 | var content = { |
|
107 | 107 | comm_id : this.comm_id, |
|
108 | 108 | target_name : this.target_name, |
|
109 | 109 | data : data || {}, |
|
110 | 110 | }; |
|
111 | return this.kernel.send_shell_message("comm_open", content, callbacks); | |
|
111 | return this.kernel.send_shell_message("comm_open", content, callbacks, metadata); | |
|
112 | 112 | }; |
|
113 | 113 | |
|
114 | Comm.prototype.send = function (data, callbacks) { | |
|
114 | Comm.prototype.send = function (data, callbacks, metadata) { | |
|
115 | 115 | var content = { |
|
116 | 116 | comm_id : this.comm_id, |
|
117 | 117 | data : data || {}, |
|
118 | 118 | }; |
|
119 | return this.kernel.send_shell_message("comm_msg", content, callbacks); | |
|
119 | return this.kernel.send_shell_message("comm_msg", content, callbacks, metadata); | |
|
120 | 120 | }; |
|
121 | 121 | |
|
122 | Comm.prototype.close = function (data, callbacks) { | |
|
122 | Comm.prototype.close = function (data, callbacks, metadata) { | |
|
123 | 123 | var content = { |
|
124 | 124 | comm_id : this.comm_id, |
|
125 | 125 | data : data || {}, |
|
126 | 126 | }; |
|
127 | return this.kernel.send_shell_message("comm_close", content, callbacks); | |
|
127 | return this.kernel.send_shell_message("comm_close", content, callbacks, metadata); | |
|
128 | 128 | }; |
|
129 | 129 | |
|
130 | 130 | // methods for registering callbacks for incoming messages |
@@ -49,7 +49,7 b' var IPython = (function (IPython) {' | |||
|
49 | 49 | }; |
|
50 | 50 | |
|
51 | 51 | |
|
52 | Kernel.prototype._get_msg = function (msg_type, content) { | |
|
52 | Kernel.prototype._get_msg = function (msg_type, content, metadata) { | |
|
53 | 53 | var msg = { |
|
54 | 54 | header : { |
|
55 | 55 | msg_id : utils.uuid(), |
@@ -57,7 +57,7 b' var IPython = (function (IPython) {' | |||
|
57 | 57 | session : this.session_id, |
|
58 | 58 | msg_type : msg_type |
|
59 | 59 | }, |
|
60 | metadata : {}, | |
|
60 | metadata : metadata || {}, | |
|
61 | 61 | content : content, |
|
62 | 62 | parent_header : {} |
|
63 | 63 | }; |
@@ -234,8 +234,8 b' var IPython = (function (IPython) {' | |||
|
234 | 234 | // Main public methods. |
|
235 | 235 | |
|
236 | 236 | // send a message on the Kernel's shell channel |
|
237 | Kernel.prototype.send_shell_message = function (msg_type, content, callbacks) { | |
|
238 | var msg = this._get_msg(msg_type, content); | |
|
237 | Kernel.prototype.send_shell_message = function (msg_type, content, callbacks, metadata) { | |
|
238 | var msg = this._get_msg(msg_type, content, metadata); | |
|
239 | 239 | this.shell_channel.send(JSON.stringify(msg)); |
|
240 | 240 | this.set_callbacks_for_msg(msg.header.msg_id, callbacks); |
|
241 | 241 | return msg.header.msg_id; |
General Comments 0
You need to be logged in to leave comments.
Login now