當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。