rxfy 0.1.2 → 0.2.1
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 +29 -0
- package/dist/index.cjs +5012 -2
- package/dist/index.d.cts +97 -2
- package/dist/index.d.ts +97 -2
- package/dist/index.js +4971 -2
- package/package.json +18 -7
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# rxfy
|
|
2
|
+
|
|
3
|
+
rxfy (/ɑɹ ɪks faɪ/) — stream-based data management. it utilizes rxjs under the hood.
|
|
4
|
+
|
|
5
|
+
# install
|
|
6
|
+
|
|
7
|
+
`pnpm install rxfy`
|
|
8
|
+
|
|
9
|
+
# api
|
|
10
|
+
|
|
11
|
+
- Atom — BehaviorSubject successor
|
|
12
|
+
- Lens — lensed atom with getter and setter
|
|
13
|
+
- Store — where all the data stored
|
|
14
|
+
- Edge — data handler and accessor
|
|
15
|
+
|
|
16
|
+
# example
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import PQueue from "p-queue";
|
|
20
|
+
import { of } from "rxjs";
|
|
21
|
+
import { createAtom, createState, createStore } from "rxfy";
|
|
22
|
+
|
|
23
|
+
const queue = new PQueue({ concurrency: 5 });
|
|
24
|
+
const state = createAtom(createState({}));
|
|
25
|
+
const store = createStore(queue, state);
|
|
26
|
+
const userStore = store.factory("users", (id) => of({ id }));
|
|
27
|
+
const user$ = userStore.get("42").toObservable();
|
|
28
|
+
user$.subscribe((x) => console.log(x));
|
|
29
|
+
```
|