Skip to content

Commit

Permalink
add @SInCE tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Dec 11, 2024
1 parent 40c33e9 commit 557a2df
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
10 changes: 10 additions & 0 deletions packages/svelte/src/reactivity/window/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { set, source } from '../../internal/client/reactivity/sources.js';

/**
* `scrollX.current` is a reactive view of `window.scrollX`. On the server it is `undefined`.
* @since 5.11.0
*/
export const scrollX = new ReactiveValue(
BROWSER ? () => window.scrollX : () => undefined,
Expand All @@ -14,6 +15,7 @@ export const scrollX = new ReactiveValue(

/**
* `scrollY.current` is a reactive view of `window.scrollY`. On the server it is `undefined`.
* @since 5.11.0
*/
export const scrollY = new ReactiveValue(
BROWSER ? () => window.scrollY : () => undefined,
Expand All @@ -22,6 +24,7 @@ export const scrollY = new ReactiveValue(

/**
* `innerWidth.current` is a reactive view of `window.innerWidth`. On the server it is `undefined`.
* @since 5.11.0
*/
export const innerWidth = new ReactiveValue(
BROWSER ? () => window.innerWidth : () => undefined,
Expand All @@ -30,6 +33,7 @@ export const innerWidth = new ReactiveValue(

/**
* `innerHeight.current` is a reactive view of `window.innerHeight`. On the server it is `undefined`.
* @since 5.11.0
*/
export const innerHeight = new ReactiveValue(
BROWSER ? () => window.innerHeight : () => undefined,
Expand All @@ -38,6 +42,7 @@ export const innerHeight = new ReactiveValue(

/**
* `outerWidth.current` is a reactive view of `window.outerWidth`. On the server it is `undefined`.
* @since 5.11.0
*/
export const outerWidth = new ReactiveValue(
BROWSER ? () => window.outerWidth : () => undefined,
Expand All @@ -46,6 +51,7 @@ export const outerWidth = new ReactiveValue(

/**
* `outerHeight.current` is a reactive view of `window.outerHeight`. On the server it is `undefined`.
* @since 5.11.0
*/
export const outerHeight = new ReactiveValue(
BROWSER ? () => window.outerHeight : () => undefined,
Expand All @@ -54,6 +60,7 @@ export const outerHeight = new ReactiveValue(

/**
* `screenLeft.current` is a reactive view of `window.screenLeft`. It is updated inside a `requestAnimationFrame` callback. On the server it is `undefined`.
* @since 5.11.0
*/
export const screenLeft = new ReactiveValue(
BROWSER ? () => window.screenLeft : () => undefined,
Expand All @@ -76,6 +83,7 @@ export const screenLeft = new ReactiveValue(

/**
* `screenTop.current` is a reactive view of `window.screenTop`. It is updated inside a `requestAnimationFrame` callback. On the server it is `undefined`.
* @since 5.11.0
*/
export const screenTop = new ReactiveValue(
BROWSER ? () => window.screenTop : () => undefined,
Expand All @@ -98,6 +106,7 @@ export const screenTop = new ReactiveValue(

/**
* `online.current` is a reactive view of `navigator.onLine`. On the server it is `undefined`.
* @since 5.11.0
*/
export const online = new ReactiveValue(
BROWSER ? () => navigator.onLine : () => undefined,
Expand All @@ -116,6 +125,7 @@ export const online = new ReactiveValue(
* Note that behaviour differs between browsers — on Chrome it will respond to the current zoom level,
* on Firefox and Safari it won't.
* @type {{ get current(): number }}
* @since 5.11.0
*/
export const devicePixelRatio = /* @__PURE__ */ new (class DevicePixelRatio {
#dpr = source(BROWSER ? window.devicePixelRatio : undefined);
Expand Down
12 changes: 11 additions & 1 deletion packages/svelte/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1965,45 +1965,55 @@ declare module 'svelte/reactivity' {
declare module 'svelte/reactivity/window' {
/**
* `scrollX.current` is a reactive view of `window.scrollX`. On the server it is `undefined`.
* @since 5.11.0
*/
export const scrollX: ReactiveValue<number | undefined>;
/**
* `scrollY.current` is a reactive view of `window.scrollY`. On the server it is `undefined`.
* @since 5.11.0
*/
export const scrollY: ReactiveValue<number | undefined>;
/**
* `innerWidth.current` is a reactive view of `window.innerWidth`. On the server it is `undefined`.
* @since 5.11.0
*/
export const innerWidth: ReactiveValue<number | undefined>;
/**
* `innerHeight.current` is a reactive view of `window.innerHeight`. On the server it is `undefined`.
* @since 5.11.0
*/
export const innerHeight: ReactiveValue<number | undefined>;
/**
* `outerWidth.current` is a reactive view of `window.outerWidth`. On the server it is `undefined`.
* @since 5.11.0
*/
export const outerWidth: ReactiveValue<number | undefined>;
/**
* `outerHeight.current` is a reactive view of `window.outerHeight`. On the server it is `undefined`.
* @since 5.11.0
*/
export const outerHeight: ReactiveValue<number | undefined>;
/**
* `screenLeft.current` is a reactive view of `window.screenLeft`. It is updated inside a `requestAnimationFrame` callback. On the server it is `undefined`.
* @since 5.11.0
*/
export const screenLeft: ReactiveValue<number | undefined>;
/**
* `screenTop.current` is a reactive view of `window.screenTop`. It is updated inside a `requestAnimationFrame` callback. On the server it is `undefined`.
* @since 5.11.0
*/
export const screenTop: ReactiveValue<number | undefined>;
/**
* `online.current` is a reactive view of `navigator.onLine`. On the server it is `undefined`.
* @since 5.11.0
*/
export const online: ReactiveValue<boolean | undefined>;
/**
* `devicePixelRatio.current` is a reactive view of `window.devicePixelRatio`. On the server it is `undefined`.
* Note that behaviour differs between browsers — on Chrome it will respond to the current zoom level,
* on Firefox and Safari it won't.
* */
* @since 5.11.0
*/
export const devicePixelRatio: {
get current(): number;
};
Expand Down

0 comments on commit 557a2df

Please sign in to comment.