6.15.0 • Published 11 months ago
barrel-rivers v6.15.0
RxJS based state management
This projects provides a basic toolset to manage states.
Example
Primitive type
const counterState = state(0);
const increment = () => counterState.set((currentCount) => ++currentCount);
const decrement = () => counterState.set((currentCount) => --currentCount);
counterState.value$.subscribe((count) => console.log(`Count is ${count}`));
increment();
counterState.set(8);
decrement();
// console output
// Count is 0
// Count is 1
// Count is 8
// Count is 7
Object
const counterState = state({ count: 0, lastUpdated: new Date() });
const increment = () => {
counterState.set(
update(
(obj) => obj.count,
(count) => ++count
)
);
counterState.set(update((obj) => obj.lastUpdated, new Date()));
};
const decrement = () => counterState.set((obj) => ({ count: obj.count - 1, lastUpdated: new Date() }));
6.12.0
11 months ago
6.11.0
11 months ago
6.15.0
11 months ago
6.14.0
11 months ago
6.13.0
11 months ago
6.10.0
1 year ago
6.9.4
2 years ago
7.0.0
2 years ago
6.9.2
2 years ago
6.9.3
2 years ago
6.7.0
3 years ago
6.9.0
3 years ago
6.8.0
3 years ago
6.9.1
3 years ago
6.6.0
3 years ago
6.3.0
3 years ago
6.2.1
3 years ago
6.2.0
3 years ago
6.5.0
3 years ago
6.4.0
3 years ago
6.2.2
3 years ago
6.5.1
3 years ago
6.1.0
3 years ago
6.0.0
3 years ago
5.0.0
3 years ago
4.0.0
3 years ago
2.0.1
3 years ago
2.0.0
3 years ago
1.1.0
3 years ago
1.0.1
4 years ago
1.0.0
4 years ago