File tree 4 files changed +58
-2
lines changed
4 files changed +58
-2
lines changed Original file line number Diff line number Diff line change 15
15
" geolocation:allow-check-permissions" ,
16
16
" geolocation:allow-request-permissions" ,
17
17
" 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"
19
23
]
20
24
}
Original file line number Diff line number Diff line change 21
21
import Scanner from ' ./views/Scanner.svelte'
22
22
import Biometric from ' ./views/Biometric.svelte'
23
23
import Geolocation from ' ./views/Geolocation.svelte'
24
+ import Haptics from ' ./views/Haptics.svelte'
24
25
25
26
import { onMount , tick } from ' svelte'
26
27
import { ask } from ' @tauri-apps/plugin-dialog'
130
131
label: ' Geolocation' ,
131
132
component: Geolocation ,
132
133
icon: ' i-ph-map-pin'
134
+ },
135
+ isMobile && {
136
+ label: ' Haptics' ,
137
+ component: Haptics,
138
+ icon: ' i-ph-vibrate'
133
139
}
134
140
]
135
141
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