From 465dbc99a09d3dc5208c8b597da7e39d599ff8ba Mon Sep 17 00:00:00 2001 From: AlexG Date: Mon, 23 Oct 2023 21:28:38 +0900 Subject: [PATCH] upd --- .../dapps/telegram-apps/tips-and-tricks.mdx | 39 +------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/docs/develop/dapps/telegram-apps/tips-and-tricks.mdx b/docs/develop/dapps/telegram-apps/tips-and-tricks.mdx index b36063302a..aa34eb2982 100644 --- a/docs/develop/dapps/telegram-apps/tips-and-tricks.mdx +++ b/docs/develop/dapps/telegram-apps/tips-and-tricks.mdx @@ -1,5 +1,3 @@ -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; # Tips and Tricks @@ -47,43 +45,10 @@ In many web applications, users might accidentally close the app while scrolling

-To prevent such accidental closures, developers can use `closing_behavior` method in the TMA. This method will display a dialog where the user can either approve or decline the closing of the Web App. +To prevent such accidental closures, enable `closing_behavior` in the TMA. This method will add a dialog where the user can either approve or decline the closing of the Web App. - - - - -```typescript -window.parent.postMessage(JSON.stringify({ - eventType: 'web_app_setup_closing_behavior', - eventData: {need_confirmation: true}, -}), 'https://web.telegram.org'); -``` - - - - - ```typescript - window.TelegramWebviewProxy.postEvent('web_app_setup_closing_behavior', JSON.stringify({ - need_confirmation: true -})); +window.Telegram.WebApp.enableClosingConfirmation() ``` - - - - - - -```typescript - window.external.notify(JSON.stringify({ - eventType: 'web_app_setup_closing_behavior', - eventData: {need_confirmation: true}, -})) - -``` - - - \ No newline at end of file