VK Mini Apps API
Library for quick and efficient development of VK Mini Apps based on VK Bridge methods.
Unlike VK Bridge, VK Mini Apps API already contains all the ready-made Javascript-functionality for interacting with the official clients.
Usage
Install the library via yarn
$ yarn add @vkontakte/vk-mini-apps-api
or npm
$ npm install @vkontakte/vk-mini-apps-api
Use in your code in the following way
import { VKMiniAppAPI } from '@vkontakte/vk-mini-apps-api';
// Creating API instance
const api = new VKMiniAppAPI();
// Initializing app
api.initApp();
// Using methods
api.getUserInfo().then(userInfo => {
console.log(userInfo.id);
});
For use in a browser, include the file dist/index.umd.js and use as follows
<script src="index.umd.js"></script>
<script>
const { VKMiniAppAPI } = window.vkMiniAppsAPI;
// Creating API instance
const api = new VKMiniAppAPI();
// Initializing app
api.initApp();
// Using methods
api.getUserInfo().then(userInfo => {
console.log(userInfo.id);
});
</script>
Full API Reference
At the link above you can find a full API Reference of the library. The API reference was generated by TypeDoc.