@telegram-apps/sdk
Version:
TypeScript Source Development Kit for Telegram Mini Apps client application.
19 lines (18 loc) • 847 B
TypeScript
import { Computed } from '@telegram-apps/signals';
import { AbortablePromise } from 'better-promises';
import { SignalsTuple } from '../signals-registry.js';
/**
* Creates a mount function for a component.
* @param component - the component name
* @param mount - function mounting the component
* @param onMounted - function that will be called whenever mount was completed.
*/
export declare function defineMountFn<Fn extends (...args: any) => AbortablePromise<any>>(component: string, mount: Fn, onMounted: (result: Awaited<ReturnType<Fn>>) => void): [
fn: (...args: Parameters<Fn>) => AbortablePromise<void>,
promise: [
...SignalsTuple<AbortablePromise<Awaited<ReturnType<Fn>>> | undefined>,
isRequesting: Computed<boolean>
],
error: SignalsTuple<Error | undefined>,
isMounted: SignalsTuple<boolean>
];