@telegram-apps/sdk-react
Version:
React bindings for Mini Apps client SDK. Contains hooks, components and other useful tools which allow usage of React along with Mini Apps client SDK.
38 lines (37 loc) • 1.64 kB
TypeScript
import { RetrieveLPResult, RetrieveLPResultCamelCased } from '@telegram-apps/sdk';
/**
* Returns the underlying signal value updating it each time the signal value changes.
* @param signal - a signal.
* @param getServerSnapshot - an optional function returning the signal value snapshot. It is used only during SSR
* to provide an initial value of the signal. When not set, defaults to the signal itself.
*/
export declare function useSignal<T>(signal: {
(): T;
sub(fn: VoidFunction): VoidFunction;
}, getServerSnapshot?: () => T): T;
/**
* @returns Launch parameters from any known source.
* @param camelCase - should the output be camel-cased.
* @throws {LaunchParamsRetrieveError} Unable to retrieve launch parameters. They are probably
* invalid.
*/
export declare function useLaunchParams(camelCase?: false): RetrieveLPResult;
/**
* @returns Launch parameters from any known source.
* @param camelCase - should the output be camel-cased.
* @throws {LaunchParamsRetrieveError} Unable to retrieve launch parameters. They are probably
* invalid.
*/
export declare function useLaunchParams(camelCase: true): RetrieveLPResultCamelCased;
/**
* @returns Launch parameters in a raw format from any known source.
* @throws {LaunchParamsRetrieveError} Unable to retrieve launch parameters. They are probably
* invalid.
* @see retrieveRawLaunchParams
*/
export declare function useRawLaunchParams(): string;
/**
* @returns Raw init data from any known source.
* @throws {LaunchParamsRetrieveError} Unable to retrieve launch params from any known source.
*/
export declare function useRawInitData(): string | undefined;