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


TypeScript operators.takeUntil函數代碼示例

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


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

示例1: it

  it('should dispose notifier if source observable completes', () => {
    const e1 =   hot('--a--|     ');
    const e1subs =   '^    !     ';
    const e2 =   hot('-------x--|');
    const e2subs =   '^    !     ';
    const expected = '--a--|     ';

    expectObservable(e1.pipe(takeUntil(e2))).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(e2.subscriptions).toBe(e2subs);
  });
開發者ID:jaychsu,項目名稱:RxJS,代碼行數:11,代碼來源:takeUntil-spec.ts

示例2: ngOnInit

    // -----------------------------------------------------------------------------------------------------
    // @ Lifecycle hooks
    // -----------------------------------------------------------------------------------------------------

    /**
     * On init
     */
    ngOnInit(): void
    {
        // Subscribe to config changes
        this._fuseConfigService.config
            .pipe(takeUntil(this._unsubscribeAll))
            .subscribe(
                (config) => {
                    this.fuseConfig = config;
                }
            );
    }
開發者ID:,項目名稱:,代碼行數:18,代碼來源:

示例3: asDiagram

  asDiagram('takeUntil')('should take values until notifier emits', () => {
    const e1 =     hot('--a--b--c--d--e--f--g--|');
    const e1subs =     '^            !          ';
    const e2 =     hot('-------------z--|       ');
    const e2subs =     '^            !          ';
    const expected =   '--a--b--c--d-|          ';

    expectObservable(e1.pipe(takeUntil(e2))).toBe(expected);
    expectSubscriptions(e1.subscriptions).toBe(e1subs);
    expectSubscriptions(e2.subscriptions).toBe(e2subs);
  });
開發者ID:jaychsu,項目名稱:RxJS,代碼行數:11,代碼來源:takeUntil-spec.ts

示例4: switchMap

 switchMap(() => merge( // then emit every 500ms, and when the navigation ends or cancels or errors. This delay must
                        // match the transition duration in the .scss file
   timer(0, 500).pipe(
     map(i => 100 - (100 / Math.pow(2, i))), // emit 0 then 50, 75, 87.5, etc.
     takeWhile(i => i < 99.95), // stop because that just triggers change detection with no visual change anymore
     takeUntil(end$), // but stop emitting every 500ms when the navigation ends or cancels or errors
     map(i => ({ value: i }))
   ),
   end$.pipe(first(), map(() => null)) // set back to null when the navigation ends or cancels or errors to hide
                                       // the progress bar
 ))
開發者ID:Ninja-Squad,項目名稱:globe42,代碼行數:11,代碼來源:navigation-progress.component.ts


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