From 60a02df2663b80dfecdc2eb6c86ae810f8b4962a Mon Sep 17 00:00:00 2001 From: Grant Nestor Date: Thu, 30 Mar 2017 15:06:13 -0700 Subject: [PATCH] Use `events.one` vs `events.on` inside of `CodeCell.execute` --- notebook/static/notebook/js/codecell.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/notebook/static/notebook/js/codecell.js b/notebook/static/notebook/js/codecell.js index 7f804b76dd..34c48ea140 100644 --- a/notebook/static/notebook/js/codecell.js +++ b/notebook/static/notebook/js/codecell.js @@ -335,11 +335,13 @@ define([ this.render(); this.events.trigger('execute.CodeCell', {cell: this}); var that = this; - this.events.on('finished_iopub.Kernel', function (evt, data) { + function handleFinished(evt, data) { if (that.kernel.id === data.kernel.id && that.last_msg_id === data.msg_id) { - that.events.trigger('finished_execute.CodeCell', {cell: that}); - } - }); + that.events.trigger('finished_execute.CodeCell', {cell: that}); + that.events.off('finished_iopub.Kernel', handleFinished); + } + } + this.events.on('finished_iopub.Kernel', handleFinished); }; /**