File tree 5 files changed +34
-7
lines changed
5 files changed +34
-7
lines changed Original file line number Diff line number Diff line change
1
+ ## v1.1.0
2
+
3
+ - Поддержка React 19 в ` peerDependencies ` .
4
+ - Добавлена новая асинхронная функция ` runTapticImpactOccurredAsync ` для корректной проверки поддержки вибрации.
5
+ - Функция ` runTapticImpactOccurred ` помечена как ` @deprecated ` и будет удалена в будущих версиях. Рекомендуется перейти на ` runTapticImpactOccurredAsync ` .
Original file line number Diff line number Diff line change @@ -116,9 +116,12 @@ const App = () => {
116
116
</tr >
117
117
118
118
<tr >
119
- <td > <code >runTapticImpactOccurred</code > </td >
120
- <td > <code >boolean</code > </td >
121
- <td > Function dispatches <code >VKWebAppTapticImpactOccurred</code > event if it is support (will return <code >true</code >). </td >
119
+ <td ><code >runTapticImpactOccurredAsync</code ></td >
120
+ <td ><code >Promise< ; boolean> ; </code ></td >
121
+ <td >
122
+ Dispatches <code>VKWebAppTapticImpactOccurred</code> event if supported.<br/>
123
+ Returns a Promise that resolves to <code>true</code> if the event was dispatched, or <code>false</code> if not supported.
124
+ </td >
122
125
</tr >
123
126
124
127
</table >
Original file line number Diff line number Diff line change 31
31
"react" : " ^18.2.0"
32
32
},
33
33
"peerDependencies" : {
34
- "@types/react" : " ^17.0.0 || ^18.0.0" ,
34
+ "@types/react" : " ^17.0.0 || ^18.0.0 || ^19.0.0 " ,
35
35
"@vkontakte/vk-bridge" : " workspace:^" ,
36
- "react" : " ^17.0.0 || ^18.1.0"
36
+ "react" : " ^17.0.0 || ^18.1.0 || ^19.0.0 "
37
37
},
38
38
"peerDependenciesMeta" : {
39
39
"@types/react" : {
Original file line number Diff line number Diff line change @@ -2,6 +2,25 @@ import vkBridge from '@vkontakte/vk-bridge';
2
2
import type { TapticVibrationPowerType } from '@vkontakte/vk-bridge' ;
3
3
4
4
/**
5
+ * Dispatch device vibration if supported.
6
+ *
7
+ * @param style - The strength of the vibration feedback.
8
+ * @returns A Promise that resolves to `true` if the vibration was triggered, or `false` if not supported.
9
+ */
10
+ export async function runTapticImpactOccurredAsync (
11
+ style : TapticVibrationPowerType ,
12
+ ) : Promise < boolean > {
13
+ const supported = await vkBridge . supportsAsync ( 'VKWebAppTapticImpactOccurred' ) ;
14
+
15
+ if ( supported ) {
16
+ vkBridge . send ( 'VKWebAppTapticImpactOccurred' , { style } ) . catch ( ( ) => undefined ) ;
17
+ return true ;
18
+ }
19
+ return false ;
20
+ }
21
+
22
+ /**
23
+ * @deprecated Use {@link runTapticImpactOccurredAsync} instead.
5
24
* Dispatch device vibration if supported.
6
25
*
7
26
* Return `false` if not supported.
Original file line number Diff line number Diff line change @@ -1565,9 +1565,9 @@ __metadata:
1565
1565
eslint-plugin-react-hooks : ^4.6.0
1566
1566
react : ^18.2.0
1567
1567
peerDependencies :
1568
- " @types/react " : ^17.0.0 || ^18.0.0
1568
+ " @types/react " : ^17.0.0 || ^18.0.0 || ^19.0.0
1569
1569
" @vkontakte/vk-bridge " : " workspace:^"
1570
- react : ^17.0.0 || ^18.1.0
1570
+ react : ^17.0.0 || ^18.1.0 || ^19.0.0
1571
1571
peerDependenciesMeta :
1572
1572
" @types/react " :
1573
1573
optional : true
You can’t perform that action at this time.
0 commit comments