Skip to content

Commit

Permalink
nbextension no longer disables execution before comm connection
Browse files Browse the repository at this point in the history
  • Loading branch information
smacke committed Apr 15, 2023
1 parent d2ee5e2 commit 04549d4
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions frontend/nbextension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const linkedWaitingClass = 'linked-waiting';
const linkedReadyClass = 'linked-ready';
const linkedReadyMakingClass = 'linked-ready-making';

let codecell_execute: any = null;
const cleanup = new Event('cleanup');

// ipyflow frontend state
Expand Down Expand Up @@ -408,7 +407,6 @@ function connectToComm(Jupyter: any, code_cell: any): () => void {
setTimeout(notifyContents, 2000);
};
notifyContents();
code_cell.CodeCell.prototype.execute = codecell_execute;
const keybinding = {
help: 'alt mode execute',
help_index: 'zz',
Expand Down Expand Up @@ -553,35 +551,22 @@ function connectToComm(Jupyter: any, code_cell: any): () => void {
return () => {
disconnected = true;
clearCellState(Jupyter);
code_cell.CodeCell.prototype.execute = function() {
// make execution a no-op while comm not connected
};
};
}

__non_webpack_require__(
['base/js/namespace', 'notebook/js/codecell'],
(Jupyter: any, code_cell: any) => {
// console.log('This is the current notebook application instance:', Jupyter.notebook);
codecell_execute = code_cell.CodeCell.prototype.execute;
code_cell.CodeCell.prototype.execute = function() {
// make execution a no-op while comm not connected
};
let commDisconnectHandler = function() {
// nothing to do by default
};
Jupyter.notebook.events.on('spec_changed.Kernel', () => {
// console.log('kernel changed');
code_cell.CodeCell.prototype.execute = function() {
// make execution a no-op while comm not connected
};
commDisconnectHandler();
});
Jupyter.notebook.events.on('kernel_restarting.Kernel', () => {
// console.log('kernel changed');
code_cell.CodeCell.prototype.execute = function() {
// make execution a no-op while comm not connected
};
commDisconnectHandler();
});
Jupyter.notebook.events.on('kernel_ready.Kernel', () => {
Expand All @@ -591,7 +576,6 @@ __non_webpack_require__(
commDisconnectHandler = function() {
// reset to no-op
};
code_cell.CodeCell.prototype.execute = codecell_execute;
}
});
}
Expand Down

0 comments on commit 04549d4

Please sign in to comment.