Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4e3aea8

Browse files
author
Jason Grout
committed
Change $.post to this.post in the kernel js file
This makes it easy to override the post function for custom communication requirements. Any replacement function, of course, needs to have the same semantics as $.post.
1 parent fb1283e commit 4e3aea8

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • IPython/html/static/services/kernels/js

IPython/html/static/services/kernels/js/kernel.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var IPython = (function (IPython) {
3535
this.username = "username";
3636
this.session_id = utils.uuid();
3737
this._msg_callbacks = {};
38+
this.post = $.post;
3839

3940
if (typeof(WebSocket) !== 'undefined') {
4041
this.WebSocket = WebSocket;
@@ -94,7 +95,7 @@ var IPython = (function (IPython) {
9495
params = params || {};
9596
if (!this.running) {
9697
var qs = $.param(params);
97-
$.post(utils.url_join_encode(this.kernel_service_url) + '?' + qs,
98+
this.post(utils.url_join_encode(this.kernel_service_url) + '?' + qs,
9899
$.proxy(this._kernel_started, this),
99100
'json'
100101
);
@@ -113,7 +114,7 @@ var IPython = (function (IPython) {
113114
$([IPython.events]).trigger('status_restarting.Kernel', {kernel: this});
114115
if (this.running) {
115116
this.stop_channels();
116-
$.post(utils.url_join_encode(this.kernel_url, "restart"),
117+
this.post(utils.url_join_encode(this.kernel_url, "restart"),
117118
$.proxy(this._kernel_started, this),
118119
'json'
119120
);
@@ -386,7 +387,7 @@ var IPython = (function (IPython) {
386387
Kernel.prototype.interrupt = function () {
387388
if (this.running) {
388389
$([IPython.events]).trigger('status_interrupting.Kernel', {kernel: this});
389-
$.post(utils.url_join_encode(this.kernel_url, "interrupt"));
390+
this.post(utils.url_join_encode(this.kernel_url, "interrupt"));
390391
}
391392
};
392393

0 commit comments

Comments
 (0)