##// END OF EJS Templates
Pass the header of output and clear_output messages to javascript callbacks
Jason Grout -
Show More
@@ -226,15 +226,15 b' var IPython = (function (IPython) {'
226 // http://ipython.org/ipython-doc/dev/development/messaging.html#execute
226 // http://ipython.org/ipython-doc/dev/development/messaging.html#execute
227 //
227 //
228 // The output_callback will be passed msg_type ('stream','display_data','pyout','pyerr')
228 // The output_callback will be passed msg_type ('stream','display_data','pyout','pyerr')
229 // of the output and the content object of the PUB/SUB channel that contains the
229 // of the output and the content and header objects of the PUB/SUB channel that contains the
230 // output:
230 // output:
231 //
231 //
232 // http://ipython.org/ipython-doc/dev/development/messaging.html#messages-on-the-pub-sub-socket
232 // http://ipython.org/ipython-doc/dev/development/messaging.html#messages-on-the-pub-sub-socket
233 //
233 //
234 // The clear_output_callback will be passed a content object that contains
234 // The clear_output_callback will be passed a content object that contains
235 // stdout, stderr and other fields that are booleans.
235 // stdout, stderr and other fields that are booleans, as well as the header object.
236 //
236 //
237 // The set_next_input_callback will bepassed the text that should become the next
237 // The set_next_input_callback will be passed the text that should become the next
238 // input cell.
238 // input cell.
239
239
240 var content = {
240 var content = {
@@ -350,6 +350,7 b' var IPython = (function (IPython) {'
350 reply = $.parseJSON(e.data);
350 reply = $.parseJSON(e.data);
351 var content = reply.content;
351 var content = reply.content;
352 var msg_type = reply.header.msg_type;
352 var msg_type = reply.header.msg_type;
353 var header = reply.header;
353 var callbacks = this.get_callbacks_for_msg(reply.parent_header.msg_id);
354 var callbacks = this.get_callbacks_for_msg(reply.parent_header.msg_id);
354 if (msg_type !== 'status' && callbacks === undefined) {
355 if (msg_type !== 'status' && callbacks === undefined) {
355 // Message not from one of this notebook's cells and there are no
356 // Message not from one of this notebook's cells and there are no
@@ -360,7 +361,7 b' var IPython = (function (IPython) {'
360 if (output_types.indexOf(msg_type) >= 0) {
361 if (output_types.indexOf(msg_type) >= 0) {
361 var cb = callbacks['output'];
362 var cb = callbacks['output'];
362 if (cb !== undefined) {
363 if (cb !== undefined) {
363 cb(msg_type, content);
364 cb(msg_type, content, header);
364 }
365 }
365 } else if (msg_type === 'status') {
366 } else if (msg_type === 'status') {
366 if (content.execution_state === 'busy') {
367 if (content.execution_state === 'busy') {
@@ -374,7 +375,7 b' var IPython = (function (IPython) {'
374 } else if (msg_type === 'clear_output') {
375 } else if (msg_type === 'clear_output') {
375 var cb = callbacks['clear_output'];
376 var cb = callbacks['clear_output'];
376 if (cb !== undefined) {
377 if (cb !== undefined) {
377 cb(content);
378 cb(content, header);
378 }
379 }
379 };
380 };
380 };
381 };
General Comments 0
You need to be logged in to leave comments. Login now