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


TypeScript operators.zip函數代碼示例

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


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

示例1: range

    return errors => range(1, 10).pipe(
        zip(errors, (i, err) => {
            if (i == 10) {
                throw err;
            }

            return i;
        }),
        flatMap(i => timer(i * 1000)),
    )
開發者ID:urandom,項目名稱:readeef,代碼行數:10,代碼來源:api.ts

示例2: it

    it('should initially return the same value for streaming and non-streaming get', (done: Function) => {
        translations = {"TEST": "This is a test"};
        translate.use('en');

        translate.stream('TEST').pipe(zip(translate.get('TEST'))).subscribe((value: [string, string]) => {
            const [streamed, nonStreamed] = value;
            expect(streamed).toEqual('This is a test');
            expect(streamed).toEqual(nonStreamed);
            done();
        });
    });
開發者ID:jupereira0920,項目名稱:core,代碼行數:11,代碼來源:translate.service.spec.ts

示例3: ngOnInit

  ngOnInit() {

    this.text = `Bacon ipsum dolor amet tongue short loin short ribs pork chop drumstick picanha 
            pancetta shank cow shoulder salami corned beef swine pig sausage. Rump flank 
            sirloin kielbasa jowl chuck sausage jerky short loin chicken. Flank sirloin frankfurter 
            corned beef turducken. Beef ribs salami ribeye, t-bone meatloaf flank jerky tongue turkey`;

    this.typewriter$ = from(this.text.split(''))
      .pipe(scan((acc, curr) => acc + curr))
      // @ts-ignore
      .pipe(zip(interval(50), x => x));

  }
開發者ID:screenm0nkey,項目名稱:angular2-examples-webpack,代碼行數:13,代碼來源:typewriter.ts

示例4: retryWhen

 retryWhen(attempts => range(1, maxTries)
   .pipe(
     zip(attempts, (i) => i),
     map(i => i * i),
     mergeMap(i =>  timer(i * ms))
   )
開發者ID:cironunes,項目名稱:angular,代碼行數:6,代碼來源:backoff.ts

示例5: it

it('should support rest parameter observables with type parameters', () => {
  const o = of(1); // $ExpectType Observable<number>
  const z = [of(2)]; // $ExpectType Observable<number>[]
  const a = o.pipe(zip<number, number[]>(...z)); // $ExpectType Observable<number[]>
});
開發者ID:DallanQ,項目名稱:rxjs,代碼行數:5,代碼來源:zip-spec.ts


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