From 93d0c4e8e732f28ae540402bd1318f7b8577805f Mon Sep 17 00:00:00 2001 From: M Pacer Date: Fri, 6 Oct 2017 16:43:17 -0700 Subject: [PATCH] reformat js for onSave to be more idiomatic & better presented --- notebook/static/notebook/js/menubar.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/notebook/static/notebook/js/menubar.js b/notebook/static/notebook/js/menubar.js index 9ac5cc3308..33ee758546 100644 --- a/notebook/static/notebook/js/menubar.js +++ b/notebook/static/notebook/js/menubar.js @@ -253,18 +253,21 @@ define('notebook/js/menubar',[ return true; // close the dialog // return false to keep it open. }; - var saveData = (function() { + var saveData = (() => { var a = document.createElement("a"); document.body.appendChild(a); a.style = "display: none"; - return function(data, fileName) { - var blob = new Blob([data], { type: "octet/stream" }), //this works for tar - url = window.URL.createObjectURL(blob); - a.href = url; - a.download = fileName; - a.click(); - window.URL.revokeObjectURL(url); - }; + return ( + (data, fileName) => { + var blob = new Blob([data], { type: "octet/stream" }), + url = window.URL.createObjectURL(blob); + a.href = url; + a.download = fileName; + a.click(); + window.URL.revokeObjectURL(url); + document.body.removeChild(a); + } + ) })(); var mod = dialog.modal({