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
Copy file name to clipboardExpand all lines: packages/docs/utils/storage/providers.md
+19-2Lines changed: 19 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,17 +13,34 @@ Storage providers are the low-level adapters that read and write to a specific s
13
13
14
14
`localStorageProvider` and `sessionStorageProvider` resolve their `globalThis.*Storage` backend lazily on each access instead of capturing it when the module is imported. This makes them safe to import before a browser-like global is available, and lets tests or non-DOM runtimes provide storage later.
15
15
16
-
###Provider factories
16
+
## Provider factories
17
17
18
-
For URL-based providers, factory functions allow customizing the history behavior. These providers check for a browser context when the provider is created. If `window.location` or `window.history` is unavailable, they return a no-op provider instead of throwing.
18
+
All built-in providers also have factory functions:
19
+
20
+
-`createNoopProvider()`
21
+
-`createLocalStorageProvider()`
22
+
-`createSessionStorageProvider()`
23
+
-`createUrlSearchParamsProvider(options?)`
24
+
-`createUrlSearchParamsInHashProvider(options?)`
25
+
26
+
Use the storage-backed factories when you want a fresh provider instance instead of the default singleton export.
27
+
28
+
The URL-based factories accept a `push` option to customize navigation behavior. They check for a browser context when the provider is created. If `window.location` or `window.history` is unavailable, they return a no-op provider instead of throwing.
0 commit comments