File tree Expand file tree Collapse file tree 4 files changed +58
-2
lines changed Expand file tree Collapse file tree 4 files changed +58
-2
lines changed Original file line number Diff line number Diff line change 1515 " geolocation:allow-check-permissions" ,
1616 " geolocation:allow-request-permissions" ,
1717 " geolocation:allow-watch-position" ,
18- " geolocation:allow-get-current-position"
18+ " geolocation:allow-get-current-position" ,
19+ " haptics:allow-impact-feedback" ,
20+ " haptics:allow-notification-feedback" ,
21+ " haptics:allow-selection-feedback" ,
22+ " haptics:allow-vibrate"
1923 ]
2024}
Original file line number Diff line number Diff line change 2121 import Scanner from ' ./views/Scanner.svelte'
2222 import Biometric from ' ./views/Biometric.svelte'
2323 import Geolocation from ' ./views/Geolocation.svelte'
24+ import Haptics from ' ./views/Haptics.svelte'
2425
2526 import { onMount , tick } from ' svelte'
2627 import { ask } from ' @tauri-apps/plugin-dialog'
130131 label: ' Geolocation' ,
131132 component: Geolocation ,
132133 icon: ' i-ph-map-pin'
134+ },
135+ isMobile && {
136+ label: ' Haptics' ,
137+ component: Haptics,
138+ icon: ' i-ph-vibrate'
133139 }
134140 ]
135141
Original file line number Diff line number Diff line change 1+ <script >
2+ import {
3+ vibrate ,
4+ impactFeedback ,
5+ notificationFeedback ,
6+ selectionFeedback
7+ } from ' @tauri-apps/plugin-haptics'
8+
9+ export let onMessage
10+ </script >
11+
12+ <div >
13+ <button
14+ class =" btn"
15+ on:click ={() => vibrate (300 ).then (onMessage ).catch (onMessage )}
16+ >vibrate short</button
17+ >
18+ <button
19+ class =" btn"
20+ on:click ={() => vibrate (1500 ).then (onMessage ).catch (onMessage )}
21+ >vibrate long</button
22+ >
23+ <button
24+ class =" btn"
25+ on:click ={() => impactFeedback (' medium' ).then (onMessage ).catch (onMessage )}
26+ >impact medium</button
27+ >
28+ <button
29+ class =" btn"
30+ on:click ={() =>
31+ notificationFeedback (' warning' ).then (onMessage ).catch (onMessage )}
32+ >notification warning</button
33+ >
34+ <button
35+ class =" btn"
36+ on:click ={() => selectionFeedback ().then (onMessage ).catch (onMessage )}
37+ >selection</button
38+ >
39+ </div >
40+
41+ <br />
42+
43+ <p >
44+ Depending on your device settings for haptic feedback some of the buttons may
45+ not work.
46+ </p >
You can’t perform that action at this time.
0 commit comments