2.1.0 • Published 5 years ago
rxfeedback v2.1.0
RxFeedback
TypeScript/JavaScript version of RxFeedback
The simplest architecture for RxJS
type FeedbackLoop<State, Event> =
(state: rx.Observable<State>, scheduler: IScheduler) => rx.Observable<Event>;
declare module 'rxjs/Observable' {
namespace Observable {
function system<State, Event>(
initialState: State,
reduce: (state: State, event: Event) => State,
feedback: FeedbackLoop<State, Event>[],
): Observable<State>;
}
}
Why
- Straightforward
- If it did happen -> Event
- If it should happen -> Request
- To fulfill Request -> Feedback loo
- Declarative
- System behavior is first declaratively specified and effects begin after subscribe is called => Compile time proof there are no "unhandled states"
Debugging is easier
- A lot of logic is just normal pure function that can be debugged using Xcode debugger, or just printing the commands.
Can be applied on any level
- Entire system
- application (state is stored inside a database, CoreData, Firebase, Realm)
- view controller (state is stored inside
system
operator) - inside feedback loop (another
system
operator inside feedback loop)
- Works awesome with dependency injection
- Testing
- Reducer is a pure function, just call it and assert results
- In case effects are being tested -> TestScheduler
- Can model circular dependencies
- Completely separates business logic from effects (Rx).
- Business logic can be transpiled between platforms
Installing with NPM
$ npm install rxfeedback
import * as RxFeedback from 'rxfeedback';
2.1.0
5 years ago
2.0.0
5 years ago
1.0.0
6 years ago
0.0.17
6 years ago
0.0.16
6 years ago
0.0.15
6 years ago
0.0.14
6 years ago
0.0.13
6 years ago
0.0.12
6 years ago
0.0.11
6 years ago
0.0.10
6 years ago
0.0.9
6 years ago
0.0.8
6 years ago
0.0.7
6 years ago
0.0.6
6 years ago
0.0.5
6 years ago
0.0.4
6 years ago
0.0.3
6 years ago
0.0.2
6 years ago
0.0.1
6 years ago