diff --git a/IPython/frontend/html/notebook/static/js/kernel.js b/IPython/frontend/html/notebook/static/js/kernel.js index dea771177..14f382f91 100644 --- a/IPython/frontend/html/notebook/static/js/kernel.js +++ b/IPython/frontend/html/notebook/static/js/kernel.js @@ -64,7 +64,7 @@ var IPython = (function (IPython) { Kernel.prototype.restart = function () { - $([IPython.events]).trigger({type: 'status_restarting.Kernel', kernel: this}); + $([IPython.events]).trigger('status_restarting.Kernel', {kernel: this}); var that = this; if (this.running) { this.stop_channels(); @@ -86,6 +86,7 @@ var IPython = (function (IPython) { this.start_channels(); this.shell_channel.onmessage = $.proxy(this._handle_shell_reply,this); this.iopub_channel.onmessage = $.proxy(this._handle_iopub_reply,this); + $([IPython.events]).trigger('status_started.Kernel', {kernel: this}); }; @@ -245,7 +246,8 @@ var IPython = (function (IPython) { user_expressions : {}, allow_stdin : false }; - $.extend(true, content, options) + $.extend(true, content, options) + $([IPython.events]).trigger('execution_request.Kernel', {kernel: this, content:content}); var msg = this._get_msg("execute_request", content); this.shell_channel.send(JSON.stringify(msg)); this.set_callbacks_for_msg(msg.header.msg_id, callbacks); @@ -279,7 +281,7 @@ var IPython = (function (IPython) { Kernel.prototype.interrupt = function () { if (this.running) { - $([IPython.events]).trigger({type: 'status_interrupting.Kernel', kernel: this}); + $([IPython.events]).trigger('status_interrupting.Kernel', {kernel: this}); $.post(this.kernel_url + "/interrupt"); }; }; @@ -312,6 +314,7 @@ var IPython = (function (IPython) { Kernel.prototype._handle_shell_reply = function (e) { reply = $.parseJSON(e.data); + $([IPython.events]).trigger('shell_reply.Kernel', {kernel: this, reply:reply}); var header = reply.header; var content = reply.content; var metadata = reply.metadata; @@ -367,12 +370,12 @@ var IPython = (function (IPython) { } } else if (msg_type === 'status') { if (content.execution_state === 'busy') { - $([IPython.events]).trigger({type: 'status_busy.Kernel', kernel: this}); + $([IPython.events]).trigger('status_busy.Kernel', {kernel: this}); } else if (content.execution_state === 'idle') { - $([IPython.events]).trigger({type: 'status_idle.Kernel', kernel: this}); + $([IPython.events]).trigger('status_idle.Kernel', {kernel: this}); } else if (content.execution_state === 'dead') { this.stop_channels(); - $([IPython.events]).trigger({type: 'status_dead.Kernel', kernel: this}); + $([IPython.events]).trigger('status_dead.Kernel', {kernel: this}); }; } else if (msg_type === 'clear_output') { var cb = callbacks['clear_output'];