From 05dc28dae7d629bcd9b2b4cb47e10aea5dc71b91 Mon Sep 17 00:00:00 2001 From: Chew Tee Ming Date: Tue, 24 Dec 2024 14:29:52 +0800 Subject: [PATCH] add docs --- documentation/docs/98-reference/20-$app-state.md | 2 +- packages/kit/src/runtime/app/state/index.js | 6 +++--- packages/kit/types/index.d.ts | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/documentation/docs/98-reference/20-$app-state.md b/documentation/docs/98-reference/20-$app-state.md index f61475fd9e15..9362eacad82f 100644 --- a/documentation/docs/98-reference/20-$app-state.md +++ b/documentation/docs/98-reference/20-$app-state.md @@ -2,7 +2,7 @@ title: $app/state --- -SvelteKit makes three readonly state objects available via the `$app/state` module — `page`, `navigating` and `updated`. +SvelteKit makes three read-only state objects available via the `$app/state` module — `page`, `navigating` and `updated`. > [!NOTE] > This module was added in 2.12. If you're using an earlier version of SvelteKit, use [`$app/stores`]($app-stores) instead. diff --git a/packages/kit/src/runtime/app/state/index.js b/packages/kit/src/runtime/app/state/index.js index 7ca4968f538f..b9622267fb31 100644 --- a/packages/kit/src/runtime/app/state/index.js +++ b/packages/kit/src/runtime/app/state/index.js @@ -11,7 +11,7 @@ import { import { BROWSER } from 'esm-env'; /** - * A reactive object with information about the current page, serving several use cases: + * A read-only reactive object with information about the current page, serving several use cases: * - retrieving the combined `data` of all pages/layouts anywhere in your component tree (also see [loading data](https://svelte.dev/docs/kit/load)) * - retrieving the current value of the `form` prop anywhere in your component tree (also see [form actions](https://svelte.dev/docs/kit/form-actions)) * - retrieving the page state that was set through `goto`, `pushState` or `replaceState` (also see [goto](https://svelte.dev/docs/kit/$app-navigation#goto) and [shallow routing](https://svelte.dev/docs/kit/shallow-routing)) @@ -39,7 +39,7 @@ import { BROWSER } from 'esm-env'; export const page = BROWSER ? client_page : server_page; /** - * An object representing an in-progress navigation, with `from`, `to`, `type` and (if `type === 'popstate'`) `delta` properties. + * A read-only object representing an in-progress navigation, with `from`, `to`, `type` and (if `type === 'popstate'`) `delta` properties. * Values are `null` when no navigation is occurring, or during server rendering. * @type {import('@sveltejs/kit').Navigation | { from: null, to: null, type: null, willUnload: null, delta: null, complete: null }} */ @@ -47,7 +47,7 @@ export const page = BROWSER ? client_page : server_page; export const navigating = BROWSER ? client_navigating : server_navigating; /** - * A reactive value that's initially `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update `current` to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling. + * A read-only reactive value that's initially `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update `current` to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling. * @type {{ get current(): boolean; check(): Promise; }} */ export const updated = BROWSER ? client_updated : server_updated; diff --git a/packages/kit/types/index.d.ts b/packages/kit/types/index.d.ts index 248dd814b10c..41b4133cc7d0 100644 --- a/packages/kit/types/index.d.ts +++ b/packages/kit/types/index.d.ts @@ -2293,7 +2293,7 @@ declare module '$app/server' { declare module '$app/state' { /** - * A reactive object with information about the current page, serving several use cases: + * A read-only reactive object with information about the current page, serving several use cases: * - retrieving the combined `data` of all pages/layouts anywhere in your component tree (also see [loading data](https://svelte.dev/docs/kit/load)) * - retrieving the current value of the `form` prop anywhere in your component tree (also see [form actions](https://svelte.dev/docs/kit/form-actions)) * - retrieving the page state that was set through `goto`, `pushState` or `replaceState` (also see [goto](https://svelte.dev/docs/kit/$app-navigation#goto) and [shallow routing](https://svelte.dev/docs/kit/shallow-routing)) @@ -2319,7 +2319,7 @@ declare module '$app/state' { * */ export const page: import("@sveltejs/kit").Page; /** - * An object representing an in-progress navigation, with `from`, `to`, `type` and (if `type === 'popstate'`) `delta` properties. + * A read-only object representing an in-progress navigation, with `from`, `to`, `type` and (if `type === 'popstate'`) `delta` properties. * Values are `null` when no navigation is occurring, or during server rendering. * */ export const navigating: import("@sveltejs/kit").Navigation | { @@ -2331,7 +2331,7 @@ declare module '$app/state' { complete: null; }; /** - * A reactive value that's initially `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update `current` to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling. + * A read-only reactive value that's initially `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update `current` to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling. * */ export const updated: { get current(): boolean;