only pass shell.reply callback to oinfo / complete

These should not have side effects, so no need to expose full callback structure.

Also, object_info method shouldn't have `_request` in its name.
This commit is contained in:
MinRK 2013-10-01 21:58:05 -07:00
parent d99e25f245
commit f7e6435256
3 changed files with 22 additions and 26 deletions

View File

@ -150,10 +150,7 @@ var IPython = (function (IPython) {
matched_text: ""
})
} else {
var callbacks = { shell : {
reply: $.proxy(this.finish_completing, this)
}};
this.cell.kernel.complete(line, cur.ch, callbacks);
this.cell.kernel.complete(line, cur.ch, $.proxy(this.finish_completing, this));
}
};

View File

@ -218,8 +218,7 @@ var IPython = (function (IPython) {
// remove everything after last open bracket
line = line.replace(endBracket, "");
return Tooltip.last_token_re.exec(line)
}
};
Tooltip.prototype._request_tooltip = function (cell, line) {
var callbacks = { shell : {

View File

@ -242,27 +242,26 @@ var IPython = (function (IPython) {
};
/**
* Get info on object asynchronoulsy
* Get info on an object
*
* @async
* @param objname {string}
* @param callback {dict}
* @method object_info_request
* @param callback {function}
* @method object_info
*
* @example
*
* When calling this method pass a callbacks structure of the form:
* When calling this method pass a callback function that expects one argument.
*
* callbacks = {
* 'object_info_reply': object_info_reply_callback
* }
*
* The `object_info_reply_callback` will be passed the content object of the
*
* `object_into_reply` message documented in
* The callback will be passed the complete `object_info_reply` message documented in
* [IPython dev documentation](http://ipython.org/ipython-doc/dev/development/messaging.html#object-information)
*/
Kernel.prototype.object_info_request = function (objname, callbacks) {
Kernel.prototype.object_info = function (objname, callback) {
var callbacks;
if (callback) {
callbacks = { shell : { reply : callback } };
}
if (typeof(objname) !== null && objname !== null) {
var content = {
oname : objname.toString(),
@ -349,25 +348,26 @@ var IPython = (function (IPython) {
};
/**
* When calling this method pass a callbacks structure of the form:
*
* When calling this method pass a function to be called with the `complete_reply` message
* as its only argument when it arrives.
* callbacks = {
* 'complete_reply': complete_reply_callback
* }
*
* The `complete_reply_callback` will be passed the content object of the
* `complete_reply` message documented
* `complete_reply` is documented
* [here](http://ipython.org/ipython-doc/dev/development/messaging.html#complete)
*
* @method complete
* @param line {integer}
* @param cursor_pos {integer}
* @param {dict} callbacks
* @param callbacks.complete_reply {function} `complete_reply_callback`
* @param callback {function}
*
*/
Kernel.prototype.complete = function (line, cursor_pos, callbacks) {
callbacks = callbacks || {};
Kernel.prototype.complete = function (line, cursor_pos, callback) {
var callbacks;
if (callback) {
callbacks = { shell : { reply : callback } };
}
var content = {
text : '',
line : line,