@telegram-apps/sdk
Version:
TypeScript Source Development Kit for Telegram Mini Apps client application.
33 lines (32 loc) • 1.08 kB
TypeScript
import { OpenLinkBrowser } from '@telegram-apps/bridge';
export interface OpenLinkOptions {
/**
* Attempts to use the instant view mode.
*/
tryInstantView?: boolean;
/**
* A preferred browser to open the link in.
*/
tryBrowser?: OpenLinkBrowser;
}
/**
* Opens a link.
*
* The Mini App will not be closed.
*
* Note that this method can be called only in response to the user
* interaction with the Mini App interface (e.g. click inside the Mini App or on the main button).
* @param url - URL to be opened.
* @param options - additional options.
* @throws {FunctionNotAvailableError} The environment is unknown
* @throws {FunctionNotAvailableError} The SDK is not initialized
* @throws {InvalidArgumentsError} Invalid URL passed
* @example
* if (openLink.isAvailable()) {
* openLink('https://google.com', {
* tryInstantView: true,
* tryBrowser: 'chrome',
* });
* }
*/
export declare const openLink: import('../../wrappers/wrapSafe.js').SafeWrapped<(url: string | URL, options?: OpenLinkOptions) => void, false, never>;