Skip to content

Commit

Permalink
disable button during compression
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenni009 committed Mar 17, 2024
1 parent b0063e9 commit 7191ad9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ import { Mapping } from './assets/mapping.json';
const fileInput = ref<HTMLInputElement | null>(null);
const saveData = ref(null);
const isDecompressing = ref(false);
async function decodeSave() {
const file = fileInput.value?.files?.[0];
if (!file) return;
isDecompressing.value = true;
const decompressedSave = await decompressSave(file, Mapping);
saveData.value = decompressedSave;
isDecompressing.value = false;
console.log('success!');
downloadFile(JSON.stringify(decompressedSave, null, 2), `${file.name}.json`);
}
Expand All @@ -32,5 +35,10 @@ function downloadFile(data, fileName) {
ref="fileInput"
type="file"
/>
<button @click="decodeSave">Decompress</button>
<button
:disabled="isDecompressing"
@click="decodeSave"
>
Decompress
</button>
</template>

0 comments on commit 7191ad9

Please sign in to comment.