The translation was generated automatically and may contain mistakes

Module: 4. Development

Lesson 6. VK Bridge Events and Features

The main thing in the lesson

  • To receive notifications from the VK Mini Apps platform, subscribe to the VK Bridge events.

  • To subscribe, create a handler bridge.subscribe() .

    This handler is called for all VK Bridge events, so in its code you need to check the type of the incoming event and only then perform the necessary actions.

  • There is no built-in support for VK Bridge in VKUI version 6.0 or higher. You have to add it yourself.

  • Most VK Bridge events run on all available platforms, but some may not be supported. For example, vibration response events are not available when the mini-app is running on the desktop version of the site.

  • To check if an event is available or not, use the method bridge.supportsAsync(...) :

    TypeScript
    bridge.supportsAsync("VKWebAppGetFriends").then( res => { if (res) { // Событие VKWebAppGetFriends поддерживается // ... } });

    Previously used for verification bridge.supports(...) , but now it’s outdated and can return irrelevant information.

  • To get information about the user who is working with the mini-app, use the event VKWebAppGetUserInfo .

Useful links

:::