Skip to content

useSizes()

Configure and retrieve window dimensions for web applications using the useSizes composable.

Usage

To utilize useSizes, ensure that you have the @heyokajs/nuxt package installed. Here is how you can use the useSizes function to dynamically manage window dimensions within your web application:

js
import { useSizes } from "@heyokajs/nuxt";

const { width, height } = useSizes(windowedMode: boolean, webgl: HTMLCanvasElement)

Options

width

Calculated width of the application window or canvas in pixels, dependent on the windowedMode setting.

height

Calculated height of the application window or canvas in pixels, dependent on the windowedMode setting.

webgl

Reference to the HTMLCanvasElement used for WebGL rendering. This parameter is essential for correctly calculating dimensions in web-based graphics applications.

windowedMode

Boolean indicating whether the application is running in windowed mode. Adjusts how dimensions are calculated based on window or full-screen mode.