Closing Behavior
The 💠component responsible for the Telegram Mini Apps closing behavior.
Mounting
Before using this component, it is necessary to mount it to work with properly configured properties. To do so, use the mount
method. It will update the isMounted
signal property.
ts
import { closingBehavior } from '@telegram-apps/sdk';
closingBehavior.mount();
closingBehavior.isMounted(); // true
ts
import {
mountClosingBehavior,
isClosingBehaviorMounted,
} from '@telegram-apps/sdk';
mountClosingBehavior();
isClosingBehaviorMounted(); // true
To unmount, use the unmount
method:
ts
closingBehavior.unmount();
closingBehavior.isMounted(); // false
ts
import {
unmountClosingBehavior,
isClosingBehaviorMounted,
} from '@telegram-apps/sdk';
unmountClosingBehavior();
isClosingBehaviorMounted(); // false
Closing Confirmation
To change the closing confirmation behavior, use the enableConfirmation()
and disableConfirmation()
methods. These methods update the isConfirmationEnabled
signal property value.
ts
closingBehavior.enableConfirmation();
closingBehavior.isConfirmationEnabled(); // true
closingBehavior.disableConfirmation();
closingBehavior.isConfirmationEnabled(); // false
ts
import {
enableClosingConfirmation,
disableClosingConfirmation,
} from '@telegram-apps/sdk';
enableClosingConfirmation();
isClosingConfirmationEnabled(); // true
disableClosingConfirmation();
isClosingConfirmationEnabled(); // false