UNPKG

@sv-use/core

Version:

A collection of Svelte 5 utilities.

28 lines (27 loc) 1.11 kB
import type { CleanupFunction } from '../__internal__/types.js'; type GetDevicePixelRatioOptions = { /** * Whether to auto-cleanup the event listener or not. * * If set to `true`, it must run in the component initialization lifecycle. * @default true */ autoCleanup?: boolean; }; type GetDevicePixelRatioReturn = { /** Whether the {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio | devicePixelRatio property} is supported or not. */ readonly isSupported: boolean; /** The current device pixel ratio. */ readonly current: number; /** * Cleans up the event listener. * @note Is called automatically if `options.autoCleanup` is set to `true`. */ cleanup: CleanupFunction; }; /** * Returns the ratio of the resolution in physical pixels to the resolution in CSS pixels for the current display device. * @see https://svelte-librarian.github.io/sv-use/docs/core/get-device-pixel-ratio */ export declare function getDevicePixelRatio(options?: GetDevicePixelRatioOptions): GetDevicePixelRatioReturn; export {};