TSdux utilities for Observables
npm install tsdux-observable






TSdux utilities for Observables.
The latest version supports RxJS version 6 only. If you want to use this package with RxJS version 5, see support-v5 branch (tsdux-observable@^2).
- How To Install
- API
- Author
```
npm install --save redux rxjs tsdux tsdux-observable
` typescript`
function ofType
actionCreators: AC | Array
): (source: Observable
Function for filtering actions with ActionCreators of tsdux. ActionCreator
This function filter out all actions except specified actions by s.
` typescript
const AddTest = action('app/test/ADD_TEST', props<{ id: number test: string }>());
const RemoveTest = action('app/test/REMOVE_TEST', props<{ id: number }>());
Observable([
AddTest.create({ id: 0, test: '123' }),
RemoveTest.create({ id: 0 }),
AddTest.create({ id: 1, test: 'ABabABC' }),
])
.let(ofType(AddTest))
.subscribe((action) => {
console.log(action);
// first logs { type: 'app/test/ADD_TEST', id: 0, test: '123' }
// and then logs { type: 'app/test/ADD_TEST', id: 1, test: 'ABabABC' }
});
`
`typescript`
function toPayload
Function for mapping Observable of PayloadAction to Observable of payload property.
` typescript``
Observable([
action('abc', payload
action('ttt', payload
])
.let(toPayload())
.toArray()
.subscribe((result) => {
console.log(result) // ['d012d@!gWE', 178]
});
Junyoung Clare Jang [@Ailrun]
[@Ailrun]: https://github.com/Ailrun