aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/lib/ts
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2023-09-28 10:17:11 -0500
committerMatt Strapp <matt@mattstrapp.net>2023-09-28 10:17:11 -0500
commit536df17c2e170f562e3c908f97f5a0579fdc69da (patch)
treeeb41d5f7ed9d400470c633c08d75ce2fef6d9efe /app/src/lib/ts
parentMake the website less ugly, especially on mobile (diff)
downloadtrinkets-536df17c2e170f562e3c908f97f5a0579fdc69da.tar
trinkets-536df17c2e170f562e3c908f97f5a0579fdc69da.tar.gz
trinkets-536df17c2e170f562e3c908f97f5a0579fdc69da.tar.bz2
trinkets-536df17c2e170f562e3c908f97f5a0579fdc69da.tar.lz
trinkets-536df17c2e170f562e3c908f97f5a0579fdc69da.tar.xz
trinkets-536df17c2e170f562e3c908f97f5a0579fdc69da.tar.zst
trinkets-536df17c2e170f562e3c908f97f5a0579fdc69da.zip
Make everything look better again
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to '')
-rw-r--r--app/src/lib/ts/download.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/src/lib/ts/download.ts b/app/src/lib/ts/download.ts
index 16712fb..c3e98b0 100644
--- a/app/src/lib/ts/download.ts
+++ b/app/src/lib/ts/download.ts
@@ -19,10 +19,11 @@ export default async function saveFile(blob: ArrayBuffer, suggestedName: string
const writable = await handle.createWritable();
await writable.write(blob);
await writable.close();
+ return;
} catch (err: unknown) {
// TypeScript
if ((err as Error)?.name !== 'AbortError') {
- console.error(err);
+ return Promise.reject(err);
}
}
} else {
@@ -30,5 +31,7 @@ export default async function saveFile(blob: ArrayBuffer, suggestedName: string
anchor.download = suggestedName ?? 'truncated';
anchor.href = URL.createObjectURL(new Blob([blob]));
anchor.click();
+ URL.revokeObjectURL(anchor.href);
+ document.body.removeChild(anchor);
}
}