本文整理匯總了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);
}