@avine/rx-data-store
Advanced tools
Comparing version 0.1.0 to 0.1.2
{ | ||
"name": "@avine/rx-data-store", | ||
"description": "From data source to reactive data store.", | ||
"version": "0.1.0", | ||
"version": "0.1.2", | ||
"private": false, | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -11,4 +11,6 @@ # rx-data-store | ||
If you write the following code all the time, then this package is for you... | ||
You don't want to use NgRx for the state management of your application, but you are still looking for a lightweight solution. | ||
Now, if you write the following code all the time, then this package is for you... | ||
Let's say you have the following **data source**: | ||
@@ -113,4 +115,9 @@ | ||
We're just scratching the surface here. | ||
Let's dive into the rich features of `RxDataStore`. | ||
Let's dive into the features of `RxDataStore`. | ||
## Usage | ||
`RxDataStore` integrates naturally with Angular since it is based on RxJS. | ||
But since it only depends on RxJS, it can be used with any other framework. | ||
## API | ||
@@ -142,7 +149,8 @@ | ||
Note that the order does not matter. You can subscribe to `data$` even after the `fetch` method has been called. | ||
Note that the order does not matter. | ||
You can subscribe to `data$` even after the `fetch` method has been called. | ||
### Set default arguments for data fetching | ||
Calling the `fetch` method is not necessary when the default arguments of the data source function are provided. | ||
Calling the `fetch` method is not necessary when the default arguments of the data source function are provided in the constructor. | ||
@@ -203,3 +211,3 @@ ```ts | ||
Subscribe to an observable (the mutation) and update the data in the data store based on the current state of the data and the response of the observable. | ||
Subscribe to an observable (the mutation) and update the data in the data store based on the current state of the data and the response of the mutation. | ||
@@ -229,3 +237,3 @@ ```ts | ||
### pending | ||
### pending$ | ||
@@ -238,3 +246,3 @@ The observable `pending$` emits `true` when a task is in progress and `false` when it is idle. | ||
### error | ||
### error$ | ||
@@ -267,3 +275,3 @@ The observable `error$` emits errors that occur during task processing. | ||
Note that the lastest data is always cached in the data store. | ||
Note that the latest data is always cached in the data store. | ||
Enabling the cache is useful when the data source is called with different arguments. | ||
@@ -293,1 +301,3 @@ | ||
[MIT](https://github.com/avine/ng-libs/blob/main/LICENSE) | ||
_Enjoy and have fun with `RxDataStore`._ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
100813
932
296