Skip to content

Commit

Permalink
Send kernel shutdown request manually on beforeunload
Browse files Browse the repository at this point in the history
  • Loading branch information
jtpio committed May 20, 2020
1 parent 0d5d6f2 commit 2ea00a6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion share/jupyter/voila/templates/default/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ require(['static/voila'], function(voila) {
async function init() {
// it seems if we attach this to early, it will not be called
window.addEventListener('beforeunload', function (e) {
kernel.shutdown();
const xhttp = new XMLHttpRequest();
xhttp.open("DELETE", `/api/kernels/${kernel.id}`, false);
xhttp.send();
kernel.dispose();
});
await widgetManager.build_widgets();
Expand Down

0 comments on commit 2ea00a6

Please sign in to comment.