mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-05-25 13:17:47 +02:00
34 lines
650 B
Svelte
34 lines
650 B
Svelte
<script>
|
|
import { show, hide } from '@tauri-apps/api/app'
|
|
|
|
export let onMessage
|
|
|
|
function showApp() {
|
|
hideApp()
|
|
.then(() => {
|
|
setTimeout(() => {
|
|
show()
|
|
.then(() => onMessage('Shown app'))
|
|
.catch(onMessage)
|
|
}, 2000)
|
|
})
|
|
.catch(onMessage)
|
|
}
|
|
|
|
function hideApp() {
|
|
return hide()
|
|
.then(() => onMessage('Hide app'))
|
|
.catch(onMessage)
|
|
}
|
|
</script>
|
|
|
|
<div>
|
|
<button
|
|
class="btn"
|
|
id="show"
|
|
title="Hides and shows the app after 2 seconds"
|
|
on:click={showApp}>Show</button
|
|
>
|
|
<button class="btn" id="hide" on:click={hideApp}>Hide</button>
|
|
</div>
|