1 | import { rx } from '@platform/util.value';
|
2 | import { filter, map, share, takeUntil } from 'rxjs/operators';
|
3 | export function create(args) {
|
4 | const $ = args.event$.pipe(takeUntil(args.until$));
|
5 | const changed$ = $.pipe(filter((e) => e.type === 'TreeState/changed'), map((e) => e.payload), share());
|
6 | const patched$ = $.pipe(filter((e) => e.type === 'TreeState/patched'), map((e) => e.payload), share());
|
7 | const childAdded$ = $.pipe(filter((e) => e.type === 'TreeState/child/added'), map((e) => e.payload), share());
|
8 | const childRemoved$ = $.pipe(filter((e) => e.type === 'TreeState/child/removed'), map((e) => e.payload), share());
|
9 | return {
|
10 | $,
|
11 | changed$,
|
12 | patched$,
|
13 | childAdded$,
|
14 | childRemoved$,
|
15 | payload: (type) => rx.payload($, type),
|
16 | };
|
17 | }
|