Skip to content

Commit

Permalink
Merge pull request #2354 from gnestor/issue-2352
Browse files Browse the repository at this point in the history
Use `events.one` vs `events.on` inside of `CodeCell.execute`
  • Loading branch information
rgbkrk authored Mar 31, 2017
2 parents 0d28945 + 60a02df commit 5db6db7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions notebook/static/notebook/js/codecell.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

/**
Expand Down

0 comments on commit 5db6db7

Please sign in to comment.