當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript operators.onErrorResumeNext函數代碼示例

本文整理匯總了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);
  });
開發者ID:MykhailoIskiv,項目名稱:rxjs,代碼行數:9,代碼來源:onErrorResumeNext-spec.ts

示例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);
  });
開發者ID:MykhailoIskiv,項目名稱:rxjs,代碼行數:9,代碼來源:onErrorResumeNext-spec.ts

示例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]);
  });
開發者ID:jaychsu,項目名稱:RxJS,代碼行數:24,代碼來源:onErrorResumeNext-spec.ts

示例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);
}
開發者ID:DallanQ,項目名稱:rxjs,代碼行數:5,代碼來源:onErrorResumeNext.ts


注:本文中的rxjs/operators.onErrorResumeNext函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。