-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(example): Add Haptics page (#2032)
- Loading branch information
1 parent
b2aea04
commit fdc382d
Showing
4 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<script> | ||
import { | ||
vibrate, | ||
impactFeedback, | ||
notificationFeedback, | ||
selectionFeedback | ||
} from '@tauri-apps/plugin-haptics' | ||
export let onMessage | ||
</script> | ||
|
||
<div> | ||
<button | ||
class="btn" | ||
on:click={() => vibrate(300).then(onMessage).catch(onMessage)} | ||
>vibrate short</button | ||
> | ||
<button | ||
class="btn" | ||
on:click={() => vibrate(1500).then(onMessage).catch(onMessage)} | ||
>vibrate long</button | ||
> | ||
<button | ||
class="btn" | ||
on:click={() => impactFeedback('medium').then(onMessage).catch(onMessage)} | ||
>impact medium</button | ||
> | ||
<button | ||
class="btn" | ||
on:click={() => | ||
notificationFeedback('warning').then(onMessage).catch(onMessage)} | ||
>notification warning</button | ||
> | ||
<button | ||
class="btn" | ||
on:click={() => selectionFeedback().then(onMessage).catch(onMessage)} | ||
>selection</button | ||
> | ||
</div> | ||
|
||
<br /> | ||
|
||
<p> | ||
Depending on your device settings for haptic feedback some of the buttons may | ||
not work. | ||
</p> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.