Skip to content

Commit 9b3aa52

Browse files
author
__kai__
committed
make kill kernel configurable.
1 parent 31c2184 commit 9b3aa52

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

notebook/static/notebook/js/notebook.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ define([
257257
// 'above', 'below', or 'selected' to get the value from another cell.
258258
default_cell_type: 'code',
259259
Header: true,
260-
Toolbar: true
260+
Toolbar: true,
261+
kill_kernel: false
261262
};
262263

263264
Notebook.prototype.validate_config = function() {
@@ -409,8 +410,18 @@ define([
409410
// Firefox 22 broke $(window).on("beforeunload")
410411
// I'm not sure why or how.
411412
window.onbeforeunload = function () {
412-
// TODO: Make killing the kernel configurable.
413-
var kill_kernel = false;
413+
/* Make kill kernel configurable.
414+
example in custom.js:
415+
var notebook = Jupyter.notebook;
416+
var config = notebook.config;
417+
var patch = {
418+
Notebook:{
419+
kill_kernel: true
420+
}
421+
};
422+
config.update(patch);
423+
*/
424+
var kill_kernel = that.class_config.get_sync("kill_kernel");
414425
if (kill_kernel) {
415426
that.session.delete();
416427
}

0 commit comments

Comments
 (0)