@vbotma/bridge
v2.2.8
Published
TypeScript package to provide communication layer between Mini App and VBot application.
Maintainers
Readme
@vbotma/bridge
The lowest level communication layer with VBot Mini Apps.
This package provides fundamental utilities and types for developing applications on the Telegram Mini Apps platform.
While a developer can use this package alone, it's recommended to use a higher-level package like @vbotma/sdk.
Installation
pnpm i @vbotma/bridge
# or
npm i @vbotma/bridge
# or
yarn add @vbotma/bridgeUsage
Here’s a basic example of how to use this package. For more details, refer to the package complete documentation.
import { on, postEvent, applyPolyfills } from '@vbotma/bridge';
// The package uses some polyfills, so let's use them.
applyPolyfills();
// Show the back button, wait for it to be clicked once,
// then hide it.
postEvent('web_app_setup_back_button', { is_visible: true });
const off = on('back_button_pressed', () => {
postEvent('web_app_setup_back_button', { is_visible: false });
off();
});