Skip to content

Commit

Permalink
Merge pull request #568 from ugrinovsky/bugfix/docs-svelte-fix
Browse files Browse the repository at this point in the history
fix(docs-svelte): fix sdk-svelte docs
  • Loading branch information
heyqbnk authored Nov 29, 2024
2 parents a432dff + f75dcef commit 69e8d64
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions apps/docs/packages/telegram-apps-sdk-svelte.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
outline: [ 2, 3 ]
outline: [2, 3]
---

# @telegram-apps/sdk-svelte
Expand Down Expand Up @@ -54,7 +54,7 @@ Here is a simple usage example of the package:
:::code-group

```svelte [index.svelte]
<script>
<script lang="ts">
import { init, backButton } from '@telegram-apps/sdk-svelte';
import { BackButton } from './BackButton.svelte';
Expand All @@ -63,16 +63,14 @@ Here is a simple usage example of the package:
init();
</script>
<template>
<BackButton />
</template>
<BackButton />
```

```svelte [BackButton.svelte]
/**
* Component which controls the Back Button visibility.
*/
<script>
<script lang="ts">
import { onMount, onDestroy } from 'svelte';
import { backButton, useSignal } from '@telegram-apps/sdk-svelte';
Expand All @@ -88,8 +86,6 @@ Here is a simple usage example of the package:
backButton.hide();
});
</script>
<template></template>
```

:::
Expand All @@ -102,7 +98,7 @@ A helper that allows you to use our [signals](./telegram-apps-signals.md) in the
returns a Svelte ref which updates every time, our signal changes.

```svelte
<script>
<script lang="ts">
import { onMount, onDestroy } from 'svelte';
import { backButton, useSignal } from '@telegram-apps/sdk-svelte';
Expand All @@ -118,22 +114,18 @@ returns a Svelte ref which updates every time, our signal changes.
backButton.hide();
});
</script>
<template></template>
```

### `useLaunchParams`

A function that returns the mini application's launch parameters.

```svelte
<script>
<script lang="ts">
import { useLaunchParams } from '@telegram-apps/sdk-svelte';
const lp = useLaunchParams();
</script>
<template>
<div>Start param: {{ lp.startParam }}</div>
</template>
<div>Start param: {lp.startParam}</div>
```

0 comments on commit 69e8d64

Please sign in to comment.