Skip to content

Commit

Permalink
🐛 Fix browser compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Androz2091 committed Mar 31, 2021
1 parent c45b980 commit b5b8b5a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/views/Loader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
const files = [];
uz.onfile = (f) => files.push(f);
if (!file.stream) {
loading = false;
error = 'This browser is not supported. Try using Google Chrome instead.';
return;
}
const reader = file.stream().getReader();
while (true) {
const { done, value } = await reader.read();
Expand All @@ -30,7 +36,7 @@
const validPackage = files.some((file) => file.name === 'README.txt');
if (!validPackage) {
error = true;
error = 'Your package seems to be corrupted. Click or drop your package file here to retry';
loading = false;
return;
}
Expand All @@ -42,7 +48,7 @@
loadTask.set(null);
console.log(`[debug] Data extracted in ${(Date.now() - extractStartAt) / 1000} seconds.`);
}).catch((err) => {
error = true;
error = 'Something went wrong... Click or drop your package file here to retry';
loading = false;
alert(err.stack);
});
Expand Down Expand Up @@ -78,7 +84,7 @@
{/if}
</div>
{:else if error}
<p class="loader-error">Something went wrong... Click or drop your package file here to retry</p>
<p class="loader-error">{error}</p>
{:else}
<p>Click or drop your package file here</p>
{/if}
Expand Down

0 comments on commit b5b8b5a

Please sign in to comment.