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


TypeScript operators.timeoutWith函數代碼示例

本文整理匯總了TypeScript中rxjs/operators.timeoutWith函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript timeoutWith函數的具體用法?TypeScript timeoutWith怎麽用?TypeScript timeoutWith使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了timeoutWith函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

it('should support a date', () => {
  const o = of('a', 'b', 'c').pipe(timeoutWith(new Date(), of(1, 2, 3))); // $ExpectType Observable<string | number>
  const p = of('a', 'b', 'c').pipe(timeoutWith(new Date(), [1, 2, 3])); // $ExpectType Observable<string | number>
  const q = of('a', 'b', 'c').pipe(timeoutWith(new Date(), Promise.resolve(5))); // $ExpectType Observable<string | number>
  const r = of('a', 'b', 'c').pipe(timeoutWith(new Date(), new Set([1, 2, 3]))); // $ExpectType Observable<string | number>
  const s = of('a', 'b', 'c').pipe(timeoutWith(new Date(), 'foo')); // $ExpectType Observable<string>
});
開發者ID:jaychsu,項目名稱:RxJS,代碼行數:7,代碼來源:timeoutWith-spec.ts

示例2: establishCache

  /**
   * initializes the cache by subscribing topic - each message is stored internally
   * @method establishCache
   * @param  {string}    topic pattern to subscribe
   */
  public establishCache(topic: string): Observable<Map<string, Ha4usMessage>> {
    this.caching$.next(topic)

    return this.cache$.pipe(
      take(1),
      timeoutWith(500, of(new Map<string, Ha4usMessage>()))
    )
  }
開發者ID:ha4us,項目名稱:ha4us.old,代碼行數:13,代碼來源:state.service.ts

示例3: mergeMap

 mergeMap((aObject: Ha4usObject) => {
   return this.$states.observe(aObject.topic).pipe(
     timeoutWith(100, of({})),
     take(1),
     map((state: Ha4usMessage) => {
       delete state.topic
       delete state.match
       return {
         object: aObject,
         state: state,
       }
     })
   )
 }),
開發者ID:ha4us,項目名稱:ha4us.old,代碼行數:14,代碼來源:stateful-objects.service.ts

示例4: checkFile

 checkFile(file: File): Observable<ValidationMetadata> {
   return this.auroraValidation(file)
     .validate().pipe(
     timeoutWith(500, this.nativeValidation(file).validate()));
 }
開發者ID:PRX,項目名稱:publish.prx.org,代碼行數:5,代碼來源:player.service.ts


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