本文整理汇总了TypeScript中rxjs/operators.zip函数的典型用法代码示例。如果您正苦于以下问题:TypeScript zip函数的具体用法?TypeScript zip怎么用?TypeScript zip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zip函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: range
return errors => range(1, 10).pipe(
zip(errors, (i, err) => {
if (i == 10) {
throw err;
}
return i;
}),
flatMap(i => timer(i * 1000)),
)
开发者ID:urandom,项目名称:readeef,代码行数:10,代码来源:api.ts
示例2: it
it('should initially return the same value for streaming and non-streaming get', (done: Function) => {
translations = {"TEST": "This is a test"};
translate.use('en');
translate.stream('TEST').pipe(zip(translate.get('TEST'))).subscribe((value: [string, string]) => {
const [streamed, nonStreamed] = value;
expect(streamed).toEqual('This is a test');
expect(streamed).toEqual(nonStreamed);
done();
});
});
开发者ID:jupereira0920,项目名称:core,代码行数:11,代码来源:translate.service.spec.ts
示例3: ngOnInit
ngOnInit() {
this.text = `Bacon ipsum dolor amet tongue short loin short ribs pork chop drumstick picanha
pancetta shank cow shoulder salami corned beef swine pig sausage. Rump flank
sirloin kielbasa jowl chuck sausage jerky short loin chicken. Flank sirloin frankfurter
corned beef turducken. Beef ribs salami ribeye, t-bone meatloaf flank jerky tongue turkey`;
this.typewriter$ = from(this.text.split(''))
.pipe(scan((acc, curr) => acc + curr))
// @ts-ignore
.pipe(zip(interval(50), x => x));
}
开发者ID:screenm0nkey,项目名称:angular2-examples-webpack,代码行数:13,代码来源:typewriter.ts
示例4: retryWhen
retryWhen(attempts => range(1, maxTries)
.pipe(
zip(attempts, (i) => i),
map(i => i * i),
mergeMap(i => timer(i * ms))
)
开发者ID:cironunes,项目名称:angular,代码行数:6,代码来源:backoff.ts
示例5: it
it('should support rest parameter observables with type parameters', () => {
const o = of(1); // $ExpectType Observable<number>
const z = [of(2)]; // $ExpectType Observable<number>[]
const a = o.pipe(zip<number, number[]>(...z)); // $ExpectType Observable<number[]>
});
开发者ID:DallanQ,项目名称:rxjs,代码行数:5,代码来源:zip-spec.ts
注:本文中的rxjs/operators.zip函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论