chore: init
This commit is contained in:
59
examples/tauri-app/src/App.svelte
Normal file
59
examples/tauri-app/src/App.svelte
Normal file
@ -0,0 +1,59 @@
|
||||
<script>
|
||||
import Greet from './lib/Greet.svelte'
|
||||
import { duck, unduck } from 'tauri-plugin-duck-api'
|
||||
|
||||
let response = ''
|
||||
|
||||
function updateResponse(returnValue) {
|
||||
response += `[${new Date().toLocaleTimeString()}] ` + (typeof returnValue === 'string' ? returnValue : JSON.stringify(returnValue)) + '<br>'
|
||||
}
|
||||
|
||||
function _duck() {
|
||||
duck().then(updateResponse).catch(updateResponse)
|
||||
}
|
||||
|
||||
function _unduck() {
|
||||
unduck().then(updateResponse).catch(updateResponse)
|
||||
}
|
||||
</script>
|
||||
|
||||
<main class="container">
|
||||
<h1>Welcome to Tauri!</h1>
|
||||
|
||||
<div class="row">
|
||||
<a href="https://vite.dev" target="_blank">
|
||||
<img src="/vite.svg" class="logo vite" alt="Vite Logo" />
|
||||
</a>
|
||||
<a href="https://tauri.app" target="_blank">
|
||||
<img src="/tauri.svg" class="logo tauri" alt="Tauri Logo" />
|
||||
</a>
|
||||
<a href="https://svelte.dev" target="_blank">
|
||||
<img src="/svelte.svg" class="logo svelte" alt="Svelte Logo" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Click on the Tauri, Vite, and Svelte logos to learn more.
|
||||
</p>
|
||||
|
||||
<div class="row">
|
||||
<Greet />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button on:click="{_duck}">Duck</button>
|
||||
<button on:click="{_unduck}">Unduck</button>
|
||||
<div>{@html response}</div>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
|
||||
<style>
|
||||
.logo.vite:hover {
|
||||
filter: drop-shadow(0 0 2em #747bff);
|
||||
}
|
||||
|
||||
.logo.svelte:hover {
|
||||
filter: drop-shadow(0 0 2em #ff3e00);
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user