Skip to content

Commit

Permalink
reformat js for onSave to be more idiomatic & better presented
Browse files Browse the repository at this point in the history
  • Loading branch information
mpacer committed Oct 6, 2017
1 parent 1a1d09d commit 93d0c4e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions notebook/static/notebook/js/menubar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 93d0c4e

Please sign in to comment.