UNPKG

@telegram-apps/sdk

Version:

TypeScript Source Development Kit for Telegram Mini Apps client application.

40 lines (39 loc) 1.68 kB
import { EventListener } from '@telegram-apps/bridge'; declare const EVENT_NAME = "home_screen_added"; /** * Adds the event listener that being called whenever the user adds the current mini app to the * device's home screen. * * Note that if the device cannot determine the installation status, a corresponding event may * not be received even if the icon has been added. * @since Mini Apps v8.0 * @throws {FunctionNotAvailableError} The environment is unknown * @throws {FunctionNotAvailableError} The SDK is not initialized * @throws {FunctionNotAvailableError} The function is not supported * @example * if (onAddedToHomeScreen.isAvailable()) { * const off = onAddedToHomeScreen(() => { * console.log('Added'); * off(); * }); * } */ export declare const onAddedToHomeScreen: import('../../wrappers/wrapSafe.js').SafeWrapped<(listener: EventListener<typeof EVENT_NAME>, once?: boolean) => VoidFunction, true, never>; /** * Removes the event listener that being called whenever the user adds the current mini app to the * device's home screen. * @since Mini Apps v8.0 * @throws {FunctionNotAvailableError} The environment is unknown * @throws {FunctionNotAvailableError} The SDK is not initialized * @throws {FunctionNotAvailableError} The function is not supported * @example * if (offAddedToHomeScreen.isAvailable()) { * const handler = () => { * console.log('Added'); * offAddedToHomeScreen(handler); * }; * onAddedToHomeScreen(handler); * } */ export declare const offAddedToHomeScreen: import('../../wrappers/wrapSafe.js').SafeWrapped<(listener: EventListener<typeof EVENT_NAME>) => void, true, never>; export {};