Telegram-Mini-Apps / telegram-apps

Made from scratch TypeScript packages, examples and documentation you will surely need to start developing on Telegram Mini Apps.
https://docs.telegram-mini-apps.com/
MIT License
400 stars 79 forks source link

[Bug]: when call init() ect. TypeError:Object(...) is not a function will show up #296

Closed iAronTalk-Hsin closed 2 months ago

iAronTalk-Hsin commented 2 months ago

Telegram Application

Other

Describe the Bug

when I call init() and some other functions of the API. TypeError:Object(...) is not a function will show up

To Reproduce

literally can't call any of the API that the sdk provides

Expected Behavior

can help me here

heyqbnk commented 2 months ago

We don't use the init function anymore. Each component has its own init* function:

import { initUtils, initBackButton, initViewport } from '@tma.js/sdk';

const utils = initUtils();
const backButton = initBackButton();
const viewport = await initViewport(); // this one is always async. Cannot be initialised in a sync way

Official documentation will be released further, sorry.

heyqbnk commented 1 month ago

Documentation related to this topic has just released. Check this out! https://docs.telegram-mini-apps.com/packages/tma-js-sdk-react