mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-13 08:12:44 +10:00
due to a miscommunication, the scope of the download agent has grown too much. this commit reduces that scopes, and intends for a lot of the heavy lifting to be done by the soon-to-be-implemented download manager.
40 lines
943 B
Vue
40 lines
943 B
Vue
<template>
|
|
<input placeholder="GAME ID" v-model="gameId" />
|
|
<input placeholder="VERSION NAME" v-model="versionName" />
|
|
|
|
<button
|
|
class="w-full rounded-md p-4 bg-blue-600 text-white"
|
|
@click="startGameDownload"
|
|
>
|
|
Download game
|
|
<span v-if="progress != 0"> ({{ Math.floor(progress * 1000) / 10 }}%) </span>
|
|
</button>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import { invoke } from "@tauri-apps/api/core";
|
|
|
|
const gameId = ref("");
|
|
const versionName = ref("");
|
|
const progress = ref(0);
|
|
|
|
async function startGameDownload() {
|
|
await invoke("download_game", {
|
|
gameId: gameId.value,
|
|
gameVersion: versionName.value,
|
|
});
|
|
|
|
setInterval(() => {
|
|
(async () => {
|
|
const currentProgress = await invoke<number>(
|
|
"get_game_download_progress",
|
|
{
|
|
gameId: gameId.value,
|
|
}
|
|
);
|
|
console.log(currentProgress);
|
|
progress.value = currentProgress;
|
|
})();
|
|
}, 100);
|
|
}
|
|
</script>
|