File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/routes/reference/reactive-utilities Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -62,8 +62,9 @@ Returns an accessor backed by the external source.
6262## Behavior
6363
6464- A producer function receives a Solid setter and returns a cleanup function.
65- - A subscribable source must expose ` subscribe() ` .
66- - Returned subscriptions are cleaned up with the owning Solid scope.
65+ - A subscribable source must expose ` subscribe() ` , and that subscription may return either a cleanup function or an object with ` unsubscribe() ` .
66+ - Emitted values are not deduplicated by equality.
67+ - Returned subscriptions are cleaned up with the current Solid owner when one exists.
6768- When ` initialValue ` is omitted, the accessor can return ` undefined ` .
6869
6970## Examples
@@ -73,7 +74,12 @@ Returns an accessor backed by the external source.
7374``` ts
7475import { from } from " solid-js" ;
7576
76- const signal = from (observableSource );
77+ const counter = from ({
78+ subscribe(next ) {
79+ const interval = setInterval (() => next (Date .now ()), 1000 );
80+ return () => clearInterval (interval );
81+ },
82+ });
7783```
7884
7985### Create an accessor from a producer function
You can’t perform that action at this time.
0 commit comments