Skip to content

Commit 5db6db7

Browse files
authored
Merge pull request #2354 from gnestor/issue-2352
Use `events.one` vs `events.on` inside of `CodeCell.execute`
2 parents 0d28945 + 60a02df commit 5db6db7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

notebook/static/notebook/js/codecell.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,13 @@ define([
335335
this.render();
336336
this.events.trigger('execute.CodeCell', {cell: this});
337337
var that = this;
338-
this.events.on('finished_iopub.Kernel', function (evt, data) {
338+
function handleFinished(evt, data) {
339339
if (that.kernel.id === data.kernel.id && that.last_msg_id === data.msg_id) {
340-
that.events.trigger('finished_execute.CodeCell', {cell: that});
341-
}
342-
});
340+
that.events.trigger('finished_execute.CodeCell', {cell: that});
341+
that.events.off('finished_iopub.Kernel', handleFinished);
342+
}
343+
}
344+
this.events.on('finished_iopub.Kernel', handleFinished);
343345
};
344346

345347
/**

0 commit comments

Comments
 (0)