You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* import { getStores, navigating, page, updated } from '$app/stores';
217
217
* ```
218
218
*
219
-
* Stores are _contextual_ — they are added to the [context](https://svelte.dev/tutorial/context-api) of your root component. This means that `page` is unique to each request on the server, rather than shared between multiple requests handled by the same server simultaneously.
219
+
* Stores on the server are _contextual_ — they are added to the [context](https://svelte.dev/tutorial/context-api) of your root component. This means that `page` is unique to each request, rather than shared between multiple requests handled by the same server simultaneously.
220
220
*
221
221
* Because of that, you must subscribe to the stores during component initialization (which happens automatically if you reference the store value, e.g. as `$page`, in a component) before you can use them.
222
+
*
223
+
* In the browser, we don't need to worry about this, and stores can be accessed from anywhere. Code that will only ever run on the browser can refer to (or subscribe to) any of these stores at any time.
222
224
*/
223
225
declare module '$app/stores'{
224
226
import{Readable}from'svelte/store';
225
227
import{Navigation,Page}from'@sveltejs/kit';
226
228
227
-
/**
228
-
* A convenience function around `getContext`. Must be called during component initialization.
229
-
* Only use this if you need to defer store subscription until after the component has mounted, for some reason.
230
-
*/
231
-
exportfunctiongetStores(): {
232
-
navigating: typeofnavigating;
233
-
page: typeofpage;
234
-
updated: typeofupdated;
235
-
};
236
-
237
229
/**
238
230
* A readable store whose value contains page data.
* A readable store whose initial value is `false`. If [`version.pollInterval`](https://kit.svelte.dev/docs/configuration#version) 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.
0 commit comments