MISC: Remove file-saver (#1217)

Also refactor to dedup our own download code
This commit is contained in:
catloversg
2024-04-20 03:38:44 +07:00
committed by GitHub
parent 216500ed32
commit 7b993f3550
9 changed files with 20 additions and 62 deletions
-16
View File
@@ -45,22 +45,6 @@ export class Script implements ContentFile {
this.server = server; // hostname of server this script is on
}
/** Download the script as a file */
download(): void {
const filename = this.filename;
const file = new Blob([this.code], { type: "text/plain" });
const a = document.createElement("a"),
url = URL.createObjectURL(file);
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
setTimeout(function () {
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
}, 0);
}
/** Invalidates the current script module and related data, e.g. when modifying the file. */
invalidateModule(): void {
// Always clear ram usage