From 40b760d83677ea30996377155cd7ed4fca4781ea Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Thu, 9 May 2013 14:02:07 +0200 Subject: [PATCH] fix callbacks as optional in js kernel.execute plus some doc fixes. Mainly to fix some backward compatibility with examples here and there. --- IPython/frontend/html/notebook/static/js/kernel.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/IPython/frontend/html/notebook/static/js/kernel.js b/IPython/frontend/html/notebook/static/js/kernel.js index 9a66865bb..92b9e34db 100644 --- a/IPython/frontend/html/notebook/static/js/kernel.js +++ b/IPython/frontend/html/notebook/static/js/kernel.js @@ -231,14 +231,16 @@ var IPython = (function (IPython) { /** * Execute given code into kernel, and pass result to callback. * + * TODO: document input_request in callbacks + * * @async * @method execute * @param {string} code - * @param callback {Object} With the following keys - * @param callback.'execute_reply' {function} - * @param callback.'output' {function} - * @param callback.'clear_output' {function} - * @param callback.'set_next_input' {function} + * @param [callbacks] {Object} With the optionnal following keys + * @param callbacks.'execute_reply' {function} + * @param callbacks.'output' {function} + * @param callbacks.'clear_output' {function} + * @param callbacks.'set_next_input' {function} * @param {object} [options] * @param [options.silent=false] {Boolean} * @param [options.user_expressions=empty_dict] {Dict} @@ -291,6 +293,7 @@ var IPython = (function (IPython) { user_expressions : {}, allow_stdin : false }; + callbacks = callbacks || {}; if (callbacks.input_request !== undefined) { content.allow_stdin = true; }