mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-05-07 12:26:41 +02:00
22991af9f4
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
34 lines
659 B
Svelte
34 lines
659 B
Svelte
<script>
|
|
import { show, hide } from "@tauri-apps/plugin-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>
|