Skip to content

Latest commit

 

History

History
54 lines (39 loc) · 1.5 KB

+page.md

File metadata and controls

54 lines (39 loc) · 1.5 KB
title description
Window Size
Reactive window size.
<script> import Meta from "$components/meta.svelte" </script>

Reactive window size.

Usage

<script>
    import { windowSize } from "@sveu/browser"

    const { width, height } = windowSize()
</script>

Example

<script>
    import { windowSize } from "@sveu/browser"
    const { width, height } = windowSize()
</script>

<p class="text-center">{$width} x {$height}</p>

API

Options

Name Description Type
initialWidth The initial width of the window. number
initialHeight The initial height of the window. number
orientation Whether to use the orientationchange. boolean
scrollbar Whether the scrollbar should be included in the width and height. boolean


Returns

Name Description Type
width A readable store with the window width. Readable<number>
height A readable store with the window height. Readable<number>