Skip to content

Commit

Permalink
MA-18060: add subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-nikitin-2022 committed Jul 4, 2024
1 parent 742bcb3 commit 70cc13c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## v2.15.0

- `bridge.supports` помечен как устаревший. Используйте вместо него `bridge.supportsAsync`.
10 changes: 10 additions & 0 deletions packages/core/src/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,16 @@ export function createVKBridge(version: string): VKBridge {
}
}

subscribe((event) => {
if (!event.detail) {
return;
}
switch (event.detail.type) {
case 'SetSupportedHandlers':
supportedHandlers = event.detail.data.supportedHandlers;
}
});

return {
send: sendPromise,
sendPromise,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/types/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1701,6 +1701,7 @@ export type ReceiveEventMap = EventReceiveNames<
'VKWebAppCallGetStatusFailed'
> &
EventReceiveNames<'VKWebAppRecommend', 'VKWebAppRecommendResult', 'VKWebAppRecommendFailed'> &
EventReceiveNames<'SetSupportedHandlers', 'SetSupportedHandlers', 'SetSupportedHandlersFailed'> &
EventReceiveNames<
'VKWebAppAddToProfile',
'VKWebAppAddToProfileResult',
Expand Down

0 comments on commit 70cc13c

Please sign in to comment.