Skip to content

Commit

Permalink
docs(sdk): replace viewport.isVisible with miniApp.isActive docs
Browse files Browse the repository at this point in the history
  • Loading branch information
heyqbnk committed Dec 17, 2024
1 parent e82d217 commit 41ef1a6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
23 changes: 22 additions & 1 deletion apps/docs/packages/telegram-apps-sdk/2-x/components/mini-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ if (miniApp.setBackgroundColor.isAvailable()) {
```

```ts [Functions]
import {
import {
setMiniAppBackgroundColor,
miniAppBackgroundColor,
} from '@telegram-apps/sdk';
Expand All @@ -172,6 +172,27 @@ if (setMiniAppBackgroundColor.isAvailable()) {

:::

## Active State

The mini application becomes inactive if it is wrapped into the bottom native Telegram client tray
or if the currently active tab of the mini apps browser is changed to another one.

To track if the mini application is currently active, use the `isActive` signal.

::: code-group

```ts [Variable]
miniApp.isActive();
```

```ts [Functions]
import { isMiniAppActive } from '@telegram-apps/sdk';

isMiniAppActive()
```

:::

## Methods

### `close`
Expand Down
19 changes: 0 additions & 19 deletions apps/docs/packages/telegram-apps-sdk/2-x/components/viewport.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,6 @@ if (bindViewportCssVars.isAvailable()) {

:::

## Visibility

To track if mini app is visible, use `isVisible` signal.
Invisible means app is collapsed or in another tab.

::: code-group

```ts [Variable]
viewport.isVisible();
```

```ts [Functions]
import { isVisible } from '@telegram-apps/sdk';

isVisible()
```

:::

## Expanding

To expand the viewport, use the `expand` method.
Expand Down

0 comments on commit 41ef1a6

Please sign in to comment.