Getting started
Core concepts
Build and deploy
Advanced
Best practices
Appendix
Reference
- @sveltejs/kit
- @sveltejs/kit/hooks
- @sveltejs/kit/node/polyfills
- @sveltejs/kit/node
- @sveltejs/kit/vite
- $app/environment
- $app/forms
- $app/navigation
- $app/paths
- $app/server
- $app/state
- $app/stores
- $env/dynamic/private
- $env/dynamic/public
- $env/static/private
- $env/static/public
- $lib
- $service-worker
- Configuration
- Command Line Interface
- Types
$app/stores
This module contains store-based equivalents of the exports from$app/state
. If you’re using SvelteKit 2.12 or later, use that module instead.
import{functiongetStores():{page:typeofpage;navigating:typeofnavigating;updated:typeofupdated;}
getStores,constnavigating:Readable<Navigation|null>
A readable store.When navigating starts, its value is aNavigation
object withfrom
,to
,type
and (iftype === 'popstate'
)delta
properties.When navigating finishes, its value reverts tonull
.
On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
@deprecatedUsenavigating
from$app/state
instead (requires Svelte 5,see docs for more info)navigating,constpage:Readable<Page<Record<string,string>,string|null>>
A readable store whose value contains page data.
On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
@deprecatedUsepage
from$app/state
instead (requires Svelte 5,see docs for more info)page,constupdated:Readable<boolean>&{check():Promise<boolean>;}
A readable store whose initial value isfalse
. Ifversion.pollInterval
is a non-zero value, SvelteKit will poll for new versions of the app and update the store value totrue
when it detects one.updated.check()
will force an immediate check, regardless of polling.
On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
@deprecatedUseupdated
from$app/state
instead (requires Svelte 5,see docs for more info)updated}from'$app/stores';
getStores
functiongetStores():{page:typeofpage;navigating:typeofnavigating;updated:typeofupdated;};
navigating
Use
navigating
from$app/state
instead (requires Svelte 5,see docs for more info)
A readable store.When navigating starts, its value is aNavigation
object withfrom
,to
,type
and (iftype === 'popstate'
)delta
properties.When navigating finishes, its value reverts tonull
.
On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
constnavigating:import('svelte/store').Readable<import('@sveltejs/kit').Navigation|null>;
page
Use
page
from$app/state
instead (requires Svelte 5,see docs for more info)
A readable store whose value contains page data.
On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
constpage:import('svelte/store').Readable<import('@sveltejs/kit').Page>;
updated
Use
updated
from$app/state
instead (requires Svelte 5,see docs for more info)
A readable store whose initial value isfalse
. Ifversion.pollInterval
is a non-zero value, SvelteKit will poll for new versions of the app and update the store value totrue
when it detects one.updated.check()
will force an immediate check, regardless of polling.
On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
constupdated:import('svelte/store').Readable<boolean>&{check():Promise<boolean>;};
Edit this page on GitHub llms.txt