Returns the platform's dimensions by default.
Retrieves the platform's viewport dimensions. If there is a specific element on the platform that you would like the dimensions of, this capability also accepts an optional argument of a query selector. If provided, it will return the DomRect of that element if found. If no matching element is found, it will return a zeroed-out DomRect.
tecton.sources.getPlatformDimensions(selector?: string): Promise<PlatformDimensions | DomRect>;export interface PlatformDimensions {
scrollY: number;
innerHeight: number;
innerWidth: number;
outletOffset?: number;
top?: number;
bottom?: number;
orientationType?: string;
orientationAngle?: number;
}export interface DomRect {
bottom: number;
height: number;
left: number;
right: number;
top: number;
width: number;
x: number;
y: number;
orientationType?: string;
orientationAngle?: number;
}Get overall platform dimensions.
tecton.sources.getPlatformDimensions().then(dimensions => {
console.log(`The platform dimensions are ${dimensions}`);
});Get dimensions of a specific element.
tecton.sources.getPlatformDimensions("#header").then(dimensions => {
console.log(`The header dimensions are ${dimensions}`);
});selectorThere is 1 frequently asked question related to this page.