Skip to content

Commit

Permalink
Add delay between 3 range export/download s
Browse files Browse the repository at this point in the history
Range json files and different browsers #19
  • Loading branch information
alkissack committed Dec 11, 2023
1 parent 4f73991 commit da90e88
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions public_html/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2801,29 +2801,31 @@ function exportRangePlot() {
//console.log("data.json written correctly " + datamax);

const link = document.createElement("a");

var blob = new Blob([datamax], {
type: "text/plain;charset=utf-8",
}); // Create blob object with file content
link.href = URL.createObjectURL(blob); // Add file content in the object URL
link.href = URL.createObjectURL(blob); // Add file content in the object URL
link.download = "maxRange.json"; // Add file name
link.click(); // Add click event to <a> tag to save file.
URL.revokeObjectURL(link.href);

blob = new Blob([datamid], {
type: "text/plain;charset=utf-8",
});
link.href = URL.createObjectURL(blob);
link.download = "midRange.json";
link.click();
URL.revokeObjectURL(link.href);
setTimeout(function(){
blob = new Blob([datamid], {type: "text/plain;charset=utf-8",});
link.href = URL.createObjectURL(blob);
link.download = "midRange.json";
link.click();
URL.revokeObjectURL(link.href);
setTimeout(function(){
blob = new Blob([datamin], {type: "text/plain;charset=utf-8",});
link.href = URL.createObjectURL(blob);
link.download = "minRange.json";
link.click();
URL.revokeObjectURL(link.href);
},5000); //delay is in milliseconds

},5000); //delay is in milliseconds

blob = new Blob([datamin], {
type: "text/plain;charset=utf-8",
});
link.href = URL.createObjectURL(blob);
link.download = "minRange.json";
link.click();
URL.revokeObjectURL(link.href);
}

function importRangePlot() {
Expand Down

0 comments on commit da90e88

Please sign in to comment.