当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript operators.delayWhen函数代码示例

本文整理汇总了TypeScript中rxjs/operators.delayWhen函数的典型用法代码示例。如果您正苦于以下问题:TypeScript delayWhen函数的具体用法?TypeScript delayWhen怎么用?TypeScript delayWhen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了delayWhen函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: retryWhen

 retryWhen(errors =>
   errors.pipe(
     // log error message
     tap(val => console.log(`Value ${val} was too high!`)),
     // restart in 5 seconds
     delayWhen(val => timer(val * 1000))
   )
开发者ID:zwvista,项目名称:SampleMisc,代码行数:7,代码来源:error-handling.service.ts

示例2: delayWhen1

 delayWhen1() {
   // emit value every second
   const message = interval(1000);
   // emit value after five seconds
   const delayForFiveSeconds = () => timer(5000);
   // after 5 seconds, start emitting delayed interval values
   const delayWhenExample = message.pipe(delayWhen(delayForFiveSeconds));
   // log values, delayed for 5 seconds
   // ex. output: 5s....1...2...3
   const subscribe = delayWhenExample.subscribe(val => console.log(val));
 }
开发者ID:zwvista,项目名称:SampleMisc,代码行数:11,代码来源:utility.service.ts

示例3: return

  return (errors: Observable<any>) =>
    errors.pipe(
      scan((count, error) => {
        if (maxRetries >= 0 && count >= maxRetries) {
          throw error;
        }

        return count + 1;
      }, 0),
      delayWhen(val =>
        timer(
          Math.min(val * delay, maxDelay || Number.MAX_SAFE_INTEGER),
          undefined,
          scheduler
        )
      )
    );
开发者ID:dcos,项目名称:dcos-ui,代码行数:17,代码来源:rxjsUtils.ts

示例4: retryWhen

 retryWhen(error =>
   error.pipe(
     tap(error => console.error(error)),
     tap(() => console.debug('Retrying in 3s...')),
     delayWhen(() => timer(3000))
   )
开发者ID:jesuscc1993,项目名称:demos,代码行数:6,代码来源:retryWhen.ts

示例5: higherOrder

export function delayWhen<T>(this: Observable<T>, delayDurationSelector: (value: T) => Observable<any>,
                             subscriptionDelay?: Observable<any>): Observable<T> {
  return higherOrder(delayDurationSelector, subscriptionDelay)(this);
}
开发者ID:DallanQ,项目名称:rxjs,代码行数:4,代码来源:delayWhen.ts

示例6: of

 observable1 = constructorZone1.run(() => {
   return of(1, 2, 3).pipe(delayWhen((v: any) => {
     return timer(v * 10);
   }));
 });
开发者ID:angular,项目名称:zone.js,代码行数:5,代码来源:rxjs.Observable.delay.spec.ts

示例7: it

it('should support an empty notifier', () => {
  const o = of(1, 2, 3).pipe(delayWhen(() => NEVER)); // $ExpectType Observable<number>
});
开发者ID:jaychsu,项目名称:RxJS,代码行数:3,代码来源:delayWhen-spec.ts


注:本文中的rxjs/operators.delayWhen函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。