Skip to content

Commit c16b998

Browse files
author
brucou
committed
feat(API) : testing API
1 parent 55302d5 commit c16b998

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,31 @@ For each test case/input sequence :
565565
566566
After each test case, the DOM anchor is emptied (`React.render(null, ...)`).
567567
568+
## getStateTransducerRxAdapter(RxApi)
569+
570+
```javascript
571+
import { filter, flatMap, map, shareReplay, switchMap } from "rxjs/operators";
572+
import { BehaviorSubject, merge, Observable } from "rxjs";
573+
574+
export const getStateTransducerRxAdapter = RxApi => {
575+
const { BehaviorSubject, merge, Observable, filter, flatMap, map, shareReplay } = RxApi;
576+
577+
return {
578+
// NOTE : this is start the machine, by sending the INIT_EVENT immediately prior to any other
579+
subjectFactory: () => new BehaviorSubject([INIT_EVENT, void 0]),
580+
// NOTE : must be bound, because, reasons
581+
merge: merge,
582+
create: fn => Observable.create(fn),
583+
filter: filter,
584+
map: map,
585+
flatMap: flatMap,
586+
shareReplay: shareReplay
587+
};
588+
};
589+
590+
```
591+
592+
568593
# Tips and gotchas
569594
- If the configured state machine library has an initial event, it can be passed using a behavior
570595
subject (subject with an initial value). In that case, the `preprocessor` must be configured to

0 commit comments

Comments
 (0)