本文整理汇总了TypeScript中rxjs/operators.onErrorResumeNext函数的典型用法代码示例。如果您正苦于以下问题:TypeScript onErrorResumeNext函数的具体用法?TypeScript onErrorResumeNext怎么用?TypeScript onErrorResumeNext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了onErrorResumeNext函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should not continue with observble does not ends', () => {
const source = hot('--');
const next1 = cold( '-a--b-');
const subs = '^ ';
const expected = '-';
expectObservable(source.pipe(onErrorResumeNext(next1))).toBe(expected);
expectSubscriptions(source.subscriptions).toBe(subs);
});
示例2: asDiagram
asDiagram('onErrorResumeNext')('should continue observable sequence with next observable', () => {
const source = hot('--a--b--#');
const next = cold( '--c--d--|');
const subs = '^ !';
const expected = '--a--b----c--d--|';
expectObservable(source.pipe(onErrorResumeNext(next))).toBe(expected);
expectSubscriptions(source.subscriptions).toBe(subs);
});
示例3: it
it('should stop listening to a synchronous observable when unsubscribed', () => {
const sideEffects: number[] = [];
const synchronousObservable = concat(
defer(() => {
sideEffects.push(1);
return of(1);
}),
defer(() => {
sideEffects.push(2);
return of(2);
}),
defer(() => {
sideEffects.push(3);
return of(3);
})
);
throwError(new Error('Some error')).pipe(
onErrorResumeNext(synchronousObservable),
takeWhile((x) => x != 2) // unsubscribe at the second side-effect
).subscribe(() => { /* noop */ });
expect(sideEffects).to.deep.equal([1, 2]);
});
示例4: higherOrder
export function onErrorResumeNext<T, R>(this: Observable<T>, ...nextSources: Array<ObservableInput<any> |
Array<ObservableInput<any>> |
((...values: Array<any>) => R)>): Observable<R> {
return higherOrder(...nextSources)(this);
}