@@ -2335,10 +2335,13 @@ declare module 'svelte/reactivity' {
2335
2335
constructor ( query : string , fallback ?: boolean | undefined ) ;
2336
2336
}
2337
2337
/**
2338
- * Returns a `subscribe` function that, if called in an effect (including expressions in the template),
2339
- * calls its `start` callback with an `update` function. Whenever `update` is called, the effect re-runs .
2338
+ * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
2339
+ * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket` .
2340
2340
*
2341
- * If `start` returns a function, it will be called when the effect is destroyed.
2341
+ * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
2342
+ * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
2343
+ *
2344
+ * If `start` returns a cleanup function, it will be called when the effect is destroyed.
2342
2345
*
2343
2346
* If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
2344
2347
* are active, and the returned teardown function will only be called when all effects are destroyed.
@@ -2366,6 +2369,7 @@ declare module 'svelte/reactivity' {
2366
2369
* }
2367
2370
*
2368
2371
* get current() {
2372
+ * // This makes the getter reactive, if read in an effect
2369
2373
* this.#subscribe();
2370
2374
*
2371
2375
* // Return the current state of the query, whether or not we're in an effect
0 commit comments