Skip to content

Commit

Permalink
Merge pull request #4306 from 00Kai0/00kai0
Browse files Browse the repository at this point in the history
make kill kernel configurable.
  • Loading branch information
minrk authored Mar 6, 2019
2 parents e2ac757 + 9b3aa52 commit 859ae0a
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions notebook/static/notebook/js/notebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ define([
// 'above', 'below', or 'selected' to get the value from another cell.
default_cell_type: 'code',
Header: true,
Toolbar: true
Toolbar: true,
kill_kernel: false
};

Notebook.prototype.validate_config = function() {
Expand Down Expand Up @@ -409,8 +410,18 @@ define([
// Firefox 22 broke $(window).on("beforeunload")
// I'm not sure why or how.
window.onbeforeunload = function () {
// TODO: Make killing the kernel configurable.
var kill_kernel = false;
/* Make kill kernel configurable.
example in custom.js:
var notebook = Jupyter.notebook;
var config = notebook.config;
var patch = {
Notebook:{
kill_kernel: true
}
};
config.update(patch);
*/
var kill_kernel = that.class_config.get_sync("kill_kernel");
if (kill_kernel) {
that.session.delete();
}
Expand Down

0 comments on commit 859ae0a

Please sign in to comment.