import { Bridge } from '../Bridge'; import { ViewportEventsMap } from './events'; /** * Contains information about current WebApp device viewport, its dimensions * and state. */ export declare class Viewport { private bridge; private _height; private _stableHeight; private _isExpanded; private ee; /** * Updates current viewport height. * * @param value - new height. * @private */ private set height(value); /** * Updates current viewport stable height. * * @param value - new stable height. * @private */ private set stableHeight(value); /** * Updates current viewport expansion status. * * @param value - new expansion status. * @private */ private set isExpanded(value); constructor(bridge: Bridge, _height: number, _stableHeight: number, _isExpanded?: boolean); /** * A method that expands the Web App to the maximum available height. To * find out if the Web App is expanded to the maximum height, refer to the * value of the `isExpanded`. * * @see isExpanded */ expand: () => void; /** * The current height of the visible area of the Web App. * * The application can display just the top part of the Web App, with its * lower part remaining outside the screen area. From this position, the * user can "pull" the Web App to its maximum height, while the bot can do * the same by calling `expand` method. As the position of the Web App * changes, the current height value of the visible area will be updated * in real time. * * Please note that the refresh rate of this value is not sufficient * to smoothly follow the lower border of the window. It should not be * used to pin interface elements to the bottom of the visible area. It's * more appropriate to use the value of the `stableHeight` * field for this purpose. * * @see init * @see expand * @see stableHeight */ get height(): number; /** * `true`, if the Web App is expanded to the maximum available height. * `false`, if the Web App occupies part of the screen and can be expanded * to the full height using `expand` method. * * @see expand */ get isExpanded(): boolean; /** * `true`, in case current viewport height is stable. */ get isStable(): boolean; /** * Adds new event listener. */ on: (event: E, listener: import("twa-core").EventListener) => void; /** * Removes event listener. */ off: (event: E, listener: import("twa-core").EventListener) => void; /** * The height of the visible area of the Web App in its last stable state. * * The application can display just the top part of the Web App, with its * lower part remaining outside the screen area. From this position, * the user can "pull" the Web App to its maximum height, while the bot can * do the same by calling `expand` method. * * Unlike the value of `height`, the value of `stableHeight` * does not change as the position of the Web App changes with user * gestures or during animations. The value of `stableHeight` * will be updated after all gestures and animations are completed and * the Web App reaches its final size. * * @see init * @see expand * @see height */ get stableHeight(): number; /** * Requests and applies fresh viewport information from native application. */ sync: () => Promise; /** * Updates current information about viewport. * * @param height - current height in pixels. * @param isExpanded - current expansion status. * @param isStateStable - is current height stable. */ update: (height: number, isExpanded: boolean, isStateStable: boolean) => void; }