Skip to content

Commit 91f62fe

Browse files
committed
docs(sdk): viewport.isVisible and visibility_changed
1 parent 8723eb6 commit 91f62fe

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

apps/docs/packages/telegram-apps-sdk/2-x/components/viewport.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,25 @@ if (bindViewportCssVars.isAvailable()) {
110110

111111
:::
112112

113+
## Visibility
114+
115+
To track if mini app is visible, use `isVisible` signal.
116+
Invisible means app is collapsed or in another tab.
117+
118+
::: code-group
119+
120+
```ts [Variable]
121+
viewport.isVisible();
122+
```
123+
124+
```ts [Functions]
125+
import { isVisible } from '@telegram-apps/sdk';
126+
127+
isVisible()
128+
```
129+
130+
:::
131+
113132
## Expanding
114133

115134
To expand the viewport, use the `expand` method.

apps/docs/platform/events.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,16 @@ user started dragging the application or called the expansion method.
349349
> application window. You should probably use a stable height instead of the current one, or handle
350350
> this problem in another way.
351351
352+
### `visibility_changed`
353+
354+
Available since: **v8.0**
355+
356+
Occurs whenever the mini app is visible or hidden (means collapsed or in another tab).
357+
358+
| Field | Type | Description |
359+
|------------|-----------|----------------------------------------------------|
360+
| is_visible | `boolean` | Indicates if the application is currently visible. |
361+
352362
### `write_access_requested`
353363

354364
Available since: **v6.9**

0 commit comments

Comments
 (0)