Skip to content

ClosingBehavior

Implements Telegram Mini Apps closing behavior functionality.

Initialization

To initialize the component, use the initClosingBehavior function:

typescript
import { initClosingBehavior } from '@telegram-apps/sdk';

const [closingBehavior] = initClosingBehavior();

Closing Confirmation

To enable and disable closing confirmation, it is required to use enableConfirmation() and disableConfirmation() methods. These methods update isConfirmationNeeded property:

typescript
closingBehavior.enableConfirmation();
console.log(closingBehavior.isConfirmationNeeded); // true  

closingBehavior.disableConfirmation();
console.log(closingBehavior.isConfirmationNeeded); // false

Events

List of events, which could be tracked:

EventListenerTriggered when
change() => voidSomething in component changed
change:isConfirmationNeeded(value: boolean) => voidisConfirmationNeeded property changed

Released under the MIT License.