universal-stores
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -5,3 +5,3 @@ { | ||
"description": "State management made simple", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "types": "dist/index.d.ts", |
@@ -124,2 +124,14 @@ # universal-stores | ||
Example with multiple sources: | ||
```ts | ||
import {makeStore, makeDerivedStore} from 'universal-stores'; | ||
const firstWord$ = makeStore('hello'); | ||
const secondWord$ = makeStore('world!'); | ||
const derived$ = makeDerivedStore([firstWord$, secondWord$], ([first, second]) => `${first} ${second}`); | ||
derived$.subscribe((v) => console.log(v)); // prints "hello world!" | ||
firstWord$.set('hi'); // will trigger console.log, printing "hi world!" | ||
``` | ||
## ReadonlyStore | ||
@@ -126,0 +138,0 @@ |
29655
184