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


TypeScript operators.mergeAll函數代碼示例

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


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

示例1: it

  it('should execute lazy HTTP request when listening to response stream', function(done) {
    function main(_sources: {HTTP: HTTPSource}) {
      return {
        HTTP: of({
          url: uri + '/pet',
          method: 'POST',
          send: {name: 'Woof', species: 'Dog'},
          lazy: true,
        }),
      };
    }

    const {sources, run} = setup(main, {HTTP: makeHTTPDriver()});
    globalSandbox.petPOSTResponse = null;

    sources.HTTP.select()
      .pipe(mergeAll())
      .subscribe();

    run();

    setTimeout(function() {
      assert.notStrictEqual(globalSandbox.petPOSTResponse, null);
      assert.strictEqual(globalSandbox.petPOSTResponse, 'added Woof the Dog');
      globalSandbox.petPOSTResponse = null;
      done();
    }, 250);
  });
開發者ID:,項目名稱:,代碼行數:28,代碼來源:

示例2: windowCount1

  windowCount1() {
    // emit every 1s
    const source = interval(1000);
    const example = source.pipe(
      // start new window every 4 emitted values
      windowCount(4),
      tap(_ => console.log('NEW WINDOW!'))
    );

    const subscribeTwo = example
      .pipe(
        // window emits nested observable
        mergeAll()
        /*
                output:
                "NEW WINDOW!"
                0
                1
                2
                3
                "NEW WINDOW!"
                4
                5
                6
                7
              */
      )
      .subscribe(val => console.log(val));
  }
開發者ID:zwvista,項目名稱:SampleMisc,代碼行數:29,代碼來源:transforming.service.ts

示例3: condaEnvsObservable

export function condaEnvsObservable(condaInfo$: Observable<CondaInfoJSON>) {
  return condaInfo$.pipe(
    map(info => {
      const envs = info.envs.map((env: string) => ({
        name: path.basename(env),
        prefix: env
      }));
      envs.push({ name: "root", prefix: info.root_prefix });
      return envs;
    }),
    map(envs => envs.map(ipyKernelTryObservable)),
    mergeAll(),
    mergeAll(),
    toArray()
  );
}
開發者ID:nteract,項目名稱:nteract,代碼行數:16,代碼來源:kernels.ts

示例4: windowTime1

  windowTime1() {
    // emit immediately then every 1s
    const source = timer(0, 1000);
    const example = source.pipe(
      // start new window every 3s
      windowTime(3000),
      tap(_ => console.log('NEW WINDOW!'))
    );

    const subscribeTwo = example
      .pipe(
        // window emits nested observable
        mergeAll()
        /*
                output:
                "NEW WINDOW!"
                0
                1
                2
                "NEW WINDOW!"
                3
                4
                5
              */
      )
      .subscribe(val => console.log(val));
  }
開發者ID:zwvista,項目名稱:SampleMisc,代碼行數:27,代碼來源:transforming.service.ts

示例5: windowWhen1

  windowWhen1() {
    // emit immediately then every 1s
    const source = timer(0, 1000);
    const example = source.pipe(
      // close window every 5s and emit observable of collected values from source
      windowWhen(() => interval(5000)),
      tap(_ => console.log('NEW WINDOW!'))
    );

    const subscribeTwo = example
      .pipe(
        // window emits nested observable
        mergeAll()
        /*
          output:
          "NEW WINDOW!"
          0
          1
          2
          3
          4
          "NEW WINDOW!"
          5
          6
          7
          8
          9
        */
      )
      .subscribe(val => console.log(val));
  }
開發者ID:zwvista,項目名稱:SampleMisc,代碼行數:31,代碼來源:transforming.service.ts

示例6: of

 observable1 = constructorZone1.run(() => {
   return of(1, 2).pipe(
       map((v: any) => {
         return of(v + 1);
       }),
       mergeAll());
 });
開發者ID:angular,項目名稱:zone.js,代碼行數:7,代碼來源:rxjs.Observable.merge.spec.ts


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