Skip to content

Commit 2ea00a6

Browse files
committed
Send kernel shutdown request manually on beforeunload
1 parent 0d5d6f2 commit 2ea00a6

File tree

1 file changed

+3
-1
lines changed
  • share/jupyter/voila/templates/default/static

1 file changed

+3
-1
lines changed

share/jupyter/voila/templates/default/static/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ require(['static/voila'], function(voila) {
4040
async function init() {
4141
// it seems if we attach this to early, it will not be called
4242
window.addEventListener('beforeunload', function (e) {
43-
kernel.shutdown();
43+
const xhttp = new XMLHttpRequest();
44+
xhttp.open("DELETE", `/api/kernels/${kernel.id}`, false);
45+
xhttp.send();
4446
kernel.dispose();
4547
});
4648
await widgetManager.build_widgets();

0 commit comments

Comments
 (0)