Skip to content

Commit 60a02df

Browse files
committed
Use events.one vs events.on inside of CodeCell.execute
1 parent 32a2932 commit 60a02df

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

notebook/static/notebook/js/codecell.js

Lines changed: 6 additions & 4 deletions
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)