edges-svelte 0.5.5 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/package.json +1 -1
package/README.md
CHANGED
@@ -8,7 +8,7 @@ No context boilerplate. No hydration headaches. Just drop-in SSR-compatible stat
|
|
8
8
|
|
9
9
|
- 🔄 Unified state for server and client
|
10
10
|
- 🧠 Persistent per-request memory via `AsyncLocalStorage`
|
11
|
-
- 💧 Tiny API
|
11
|
+
- 💧 Tiny API
|
12
12
|
- 💥 Instant serialization without magic
|
13
13
|
- 🧩 Provider-based dependency injection, zero runtime overhead
|
14
14
|
|
@@ -117,9 +117,17 @@ To improve performance and avoid redundant computations, **EdgeS** supports cach
|
|
117
117
|
import { createProvider } from 'edges-svelte';
|
118
118
|
|
119
119
|
const myProvider = createProvider({
|
120
|
-
cacheKey:
|
120
|
+
cacheKey: 'MyUniqueProviderName',
|
121
121
|
factory: ({ createState }, params) => {
|
122
|
-
const
|
122
|
+
const myService = new MyService();
|
123
|
+
const someData = createState('userData', () => undefined);
|
124
|
+
|
125
|
+
const setUserData = async () => {
|
126
|
+
await myService.getData().then((user) => {
|
127
|
+
userData.set(user);
|
128
|
+
});
|
129
|
+
};
|
130
|
+
|
123
131
|
return { userData };
|
124
132
|
}
|
125
133
|
});
|