$app/stores
import { function getStores(): {
page: typeof page;
navigating: typeof navigating;
updated: typeof updated;
}
getStores, const navigating: Readable<Navigation | null>
A readable store.
When navigating starts, its value is a Navigation
object with from
, to
, type
and (if type === 'popstate'
) delta
properties.
When navigating finishes, its value reverts to null
.
On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
navigating, const page: 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.
page, const updated: Readable<boolean> & {
check(): Promise<boolean>;
}
A readable store whose initial value is false
. If version.pollInterval
is a non-zero value, SvelteKit will poll for new versions of the app and update the store value to true
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.
updated } from '$app/stores';
getStores
function getStores(): {
page: typeof page;
navigating: typeof navigating;
updated: typeof updated;
};
导航
一个可读存储。导航开始时,其值为一个包含 from
、to
、type
和(如果 type === 'popstate'
)delta
属性的 Navigation
对象。导航完成后,其值恢复为 null
。
在服务器端,此存储只能在组件初始化期间订阅。在浏览器中,它可以随时订阅。
const navigating: import('svelte/store').Readable<
import('@sveltejs/kit').Navigation | null
>;
页面
一个可读存储,其值包含页面数据。
在服务器端,此存储只能在组件初始化期间订阅。在浏览器中,它可以随时订阅。
const page: import('svelte/store').Readable<
import('@sveltejs/kit').Page
>;
更新
一个可读存储,其初始值为 false
。如果 version.pollInterval
为非零值,SvelteKit 将轮询应用程序的新版本,并在检测到新版本时将存储值更新为 true
。updated.check()
将强制立即检查,而不管轮询。
在服务器端,此存储只能在组件初始化期间订阅。在浏览器中,它可以随时订阅。
const updated: import('svelte/store').Readable<boolean> & {
check(): Promise<boolean>;
};