Skip to content

Commit 42b8d77

Browse files
committed
tweak docs
1 parent cb2efe6 commit 42b8d77

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

documentation/docs/98-reference/21-svelte-reactivity-window.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: svelte/reactivity/window
33
---
44

5-
This module exports reactive versions of various `window` properties, which you can use in components and [deriveds]($derived) and [effects]($effect) without using [`<svelte:window>`](svelte-window) bindings or manually creating your own event listeners.
5+
This module exports reactive versions of various `window` values, each of which has a reactive `current` property that you can reference in reactive contexts (templates, [deriveds]($derived) and [effects]($effect)) without using [`<svelte:window>`](svelte-window) bindings or manually creating your own event listeners.
66

77
```svelte
88
<script>

packages/svelte/src/reactivity/window/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,55 +5,55 @@ import { get } from '../../internal/client/index.js';
55
import { set, source } from '../../internal/client/reactivity/sources.js';
66

77
/**
8-
* `scrollX.current` is a reactive view of `window.scrollX`. On the server it is `undefined`
8+
* `scrollX.current` is a reactive view of `window.scrollX`. On the server it is `undefined`.
99
*/
1010
export const scrollX = new ReactiveValue(
1111
BROWSER ? () => window.scrollX : () => undefined,
1212
(update) => on(window, 'scroll', update)
1313
);
1414

1515
/**
16-
* `scrollY.current` is a reactive view of `window.scrollY`. On the server it is `undefined`
16+
* `scrollY.current` is a reactive view of `window.scrollY`. On the server it is `undefined`.
1717
*/
1818
export const scrollY = new ReactiveValue(
1919
BROWSER ? () => window.scrollY : () => undefined,
2020
(update) => on(window, 'scroll', update)
2121
);
2222

2323
/**
24-
* `innerWidth.current` is a reactive view of `window.innerWidth`. On the server it is `undefined`
24+
* `innerWidth.current` is a reactive view of `window.innerWidth`. On the server it is `undefined`.
2525
*/
2626
export const innerWidth = new ReactiveValue(
2727
BROWSER ? () => window.innerWidth : () => undefined,
2828
(update) => on(window, 'resize', update)
2929
);
3030

3131
/**
32-
* `innerHeight.current` is a reactive view of `window.innerHeight`. On the server it is `undefined`
32+
* `innerHeight.current` is a reactive view of `window.innerHeight`. On the server it is `undefined`.
3333
*/
3434
export const innerHeight = new ReactiveValue(
3535
BROWSER ? () => window.innerHeight : () => undefined,
3636
(update) => on(window, 'resize', update)
3737
);
3838

3939
/**
40-
* `outerWidth.current` is a reactive view of `window.outerWidth`. On the server it is `undefined`
40+
* `outerWidth.current` is a reactive view of `window.outerWidth`. On the server it is `undefined`.
4141
*/
4242
export const outerWidth = new ReactiveValue(
4343
BROWSER ? () => window.outerWidth : () => undefined,
4444
(update) => on(window, 'resize', update)
4545
);
4646

4747
/**
48-
* `outerHeight.current` is a reactive view of `window.outerHeight`. On the server it is `undefined`
48+
* `outerHeight.current` is a reactive view of `window.outerHeight`. On the server it is `undefined`.
4949
*/
5050
export const outerHeight = new ReactiveValue(
5151
BROWSER ? () => window.outerHeight : () => undefined,
5252
(update) => on(window, 'resize', update)
5353
);
5454

5555
/**
56-
* `screenLeft.current` is a reactive view of `window.screenLeft`. On the server it is `undefined`
56+
* `screenLeft.current` is a reactive view of `window.screenLeft`. On the server it is `undefined`.
5757
*/
5858
export const screenLeft = new ReactiveValue(
5959
BROWSER ? () => window.screenLeft : () => undefined,
@@ -75,7 +75,7 @@ export const screenLeft = new ReactiveValue(
7575
);
7676

7777
/**
78-
* `screenTop.current` is a reactive view of `window.screenTop`. On the server it is `undefined`
78+
* `screenTop.current` is a reactive view of `window.screenTop`. On the server it is `undefined`.
7979
*/
8080
export const screenTop = new ReactiveValue(
8181
BROWSER ? () => window.screenTop : () => undefined,
@@ -97,7 +97,7 @@ export const screenTop = new ReactiveValue(
9797
);
9898

9999
/**
100-
* `online.current` is a reactive view of `navigator.onLine`. On the server it is `undefined`
100+
* `online.current` is a reactive view of `navigator.onLine`. On the server it is `undefined`.
101101
*/
102102
export const online = new ReactiveValue(
103103
BROWSER ? () => navigator.onLine : () => undefined,
@@ -114,7 +114,7 @@ export const online = new ReactiveValue(
114114
/**
115115
* `devicePixelRatio.current` is a reactive view of `window.devicePixelRatio`. On the server it is `undefined`.
116116
* Note that behaviour differs between browsers — on Chrome it will respond to the current zoom level,
117-
* on Firefox and Safari it won't
117+
* on Firefox and Safari it won't.
118118
* @type {{ get current(): number }}
119119
*/
120120
export const devicePixelRatio = /* @__PURE__ */ new (class DevicePixelRatio {

packages/svelte/types/index.d.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,45 +1964,45 @@ declare module 'svelte/reactivity' {
19641964

19651965
declare module 'svelte/reactivity/window' {
19661966
/**
1967-
* `scrollX.current` is a reactive view of `window.scrollX`. On the server it is `undefined`
1967+
* `scrollX.current` is a reactive view of `window.scrollX`. On the server it is `undefined`.
19681968
*/
19691969
export const scrollX: ReactiveValue<number | undefined>;
19701970
/**
1971-
* `scrollY.current` is a reactive view of `window.scrollY`. On the server it is `undefined`
1971+
* `scrollY.current` is a reactive view of `window.scrollY`. On the server it is `undefined`.
19721972
*/
19731973
export const scrollY: ReactiveValue<number | undefined>;
19741974
/**
1975-
* `innerWidth.current` is a reactive view of `window.innerWidth`. On the server it is `undefined`
1975+
* `innerWidth.current` is a reactive view of `window.innerWidth`. On the server it is `undefined`.
19761976
*/
19771977
export const innerWidth: ReactiveValue<number | undefined>;
19781978
/**
1979-
* `innerHeight.current` is a reactive view of `window.innerHeight`. On the server it is `undefined`
1979+
* `innerHeight.current` is a reactive view of `window.innerHeight`. On the server it is `undefined`.
19801980
*/
19811981
export const innerHeight: ReactiveValue<number | undefined>;
19821982
/**
1983-
* `outerWidth.current` is a reactive view of `window.outerWidth`. On the server it is `undefined`
1983+
* `outerWidth.current` is a reactive view of `window.outerWidth`. On the server it is `undefined`.
19841984
*/
19851985
export const outerWidth: ReactiveValue<number | undefined>;
19861986
/**
1987-
* `outerHeight.current` is a reactive view of `window.outerHeight`. On the server it is `undefined`
1987+
* `outerHeight.current` is a reactive view of `window.outerHeight`. On the server it is `undefined`.
19881988
*/
19891989
export const outerHeight: ReactiveValue<number | undefined>;
19901990
/**
1991-
* `screenLeft.current` is a reactive view of `window.screenLeft`. On the server it is `undefined`
1991+
* `screenLeft.current` is a reactive view of `window.screenLeft`. On the server it is `undefined`.
19921992
*/
19931993
export const screenLeft: ReactiveValue<number | undefined>;
19941994
/**
1995-
* `screenTop.current` is a reactive view of `window.screenTop`. On the server it is `undefined`
1995+
* `screenTop.current` is a reactive view of `window.screenTop`. On the server it is `undefined`.
19961996
*/
19971997
export const screenTop: ReactiveValue<number | undefined>;
19981998
/**
1999-
* `online.current` is a reactive view of `navigator.onLine`. On the server it is `undefined`
1999+
* `online.current` is a reactive view of `navigator.onLine`. On the server it is `undefined`.
20002000
*/
20012001
export const online: ReactiveValue<boolean | undefined>;
20022002
/**
20032003
* `devicePixelRatio.current` is a reactive view of `window.devicePixelRatio`. On the server it is `undefined`.
20042004
* Note that behaviour differs between browsers — on Chrome it will respond to the current zoom level,
2005-
* on Firefox and Safari it won't
2005+
* on Firefox and Safari it won't.
20062006
* */
20072007
export const devicePixelRatio: {
20082008
get current(): number;

0 commit comments

Comments
 (0)