本文整理汇总了TypeScript中rxjs/operators.combineLatest函数的典型用法代码示例。如果您正苦于以下问题:TypeScript combineLatest函数的具体用法?TypeScript combineLatest怎么用?TypeScript combineLatest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了combineLatest函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(private store: Store<any>) {
this.peoples$ = store
.select("peopleReducer")
.pipe(combineLatest(store.select("filterReducer")))
.pipe(map(this.filterFn));
this.peoples$.subscribe(people => console.log(people));
}
示例2: asDiagram
asDiagram('combineLatest')('should combine events from two cold observables', () => {
const e1 = cold('-a--b-----c-d-e-|');
const e2 = cold('--1--2-3-4---| ');
const expected = '--A-BC-D-EF-G-H-|';
const result = e1.pipe(combineLatest(e2, (a, b) => String(a) + String(b)));
expectObservable(result).toBe(expected, {
A: 'a1', B: 'b1', C: 'b2', D: 'b3', E: 'b4', F: 'c4', G: 'd4', H: 'e4'
});
});
示例3: it
it('should work with hot and hot', () => {
const e1 = hot('--a--^--b--c--|', { a: 'a', b: 'b', c: 'c' });
const e1subs = '^ !';
const e2 = hot('---e-^---f--g--|', { e: 'e', f: 'f', g: 'g' });
const e2subs = '^ !';
const expected = '----x-yz--|';
const result = e1.pipe(combineLatest(e2, (x, y) => x + y));
expectObservable(result).toBe(expected, { x: 'bf', y: 'cf', z: 'cg' });
expectSubscriptions(e1.subscriptions).toBe(e1subs);
expectSubscriptions(e2.subscriptions).toBe(e2subs);
});