File size: 964 Bytes
2d8be8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<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>