• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript rxjs.range函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中rxjs.range函数的典型用法代码示例。如果您正苦于以下问题:TypeScript range函数的具体用法?TypeScript range怎么用?TypeScript range使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了range函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: range

 observable1 = constructorZone1.run(() => {
   return range(0, 3).pipe(
       map(function(x: any) {
         return range(x, 3);
       }),
       switchAll());
 });
开发者ID:angular,项目名称:zone.js,代码行数:7,代码来源:rxjs.Observable.merge.spec.ts


示例2: range

export const createEcho = (): Echo => {
  const echoEffect = range(1, 5)
    .pipe(
      mergeMap(i => of(i).pipe(delay(500 * i))),
      repeat(),
    )

  const { eventStream: mouseoutStream, next: mouseout } = ngEventHandler<void>()
  const { eventStream: mouseoverStream, next: mouseover } = ngEventHandler<void>()

  const def = of(0)

  const effect = merge(
      of(def),
      mouseoverStream.pipe(
        map(() => echoEffect.pipe(takeUntil(mouseoutStream)))),
      mouseoutStream.pipe(map(() => def))
    )
    .pipe(mergeAll())

  return {
    mouseout,
    mouseover,
    effect$: effect,
  }
}
开发者ID:jamesbs,项目名称:flashcards,代码行数:26,代码来源:echo.ts


示例3: Promise

      await new Promise(resolve => {
        range(0, trackDatas.length)
          .pipe(
            concatMap(index => {
              return from(
                new Promise(resolve2 => {
                  createTrack({
                    name: trackDatas[index].name,
                    desc: '',
                    creatorId: taskBoard.get('ownerId'),
                    boardId: taskBoardDomain.id
                  }).then(trackData => {
                    TaskCardModel
                      .where({
                        taskTrackId: trackDatas[index].id
                      })
                      .fetchAll().then(cards => {
                        const cardDatas = cards.map(c => {
                          return {
                            id: c.id,
                            title: c.get('title'),
                            type: c.get('type')
                          };
                        });

                        range(0, cardDatas.length)
                          .pipe(
                            concatMap(index2 => {
                              return from(
                                new Promise(resolve3 => {
                                  createTaskCard({
                                    title: cardDatas[index2].title,
                                    boardId: taskBoard.id,
                                    trackId: trackData.id,
                                    type: cardDatas[index2].type || TaskCardType.NORMAL,
                                    creatorId: taskBoard.get('ownerId')
                                  }).then(() => {
                                    resolve3();
                                  });
                                })
                              );
                            })
                          )
                          .subscribe({
                            complete: () => {
                              resolve2();
                            }
                          });
                      });
                  });
                })
              );
            })
          )
          .subscribe({
            complete: () => {
              resolve();
            }
          });
      });
开发者ID:A-Horse,项目名称:bblist-backend,代码行数:60,代码来源:migrations.ts


示例4: range

                      .fetchAll().then(cards => {
                        const cardDatas = cards.map(c => {
                          return {
                            id: c.id,
                            title: c.get('title'),
                            type: c.get('type')
                          };
                        });

                        range(0, cardDatas.length)
                          .pipe(
                            concatMap(index2 => {
                              return from(
                                new Promise(resolve3 => {
                                  createTaskCard({
                                    title: cardDatas[index2].title,
                                    boardId: taskBoard.id,
                                    trackId: trackData.id,
                                    type: cardDatas[index2].type || TaskCardType.NORMAL,
                                    creatorId: taskBoard.get('ownerId')
                                  }).then(() => {
                                    resolve3();
                                  });
                                })
                              );
                            })
                          )
                          .subscribe({
                            complete: () => {
                              resolve2();
                            }
                          });
                      });
开发者ID:A-Horse,项目名称:bblist-backend,代码行数:33,代码来源:migrations.ts


示例5: it

 it('should count a range() source observable', (done: MochaDone) => {
   range(1, 10).pipe(count()).subscribe(
     (value: number) => {
       expect(value).to.equal(10);
     }, (x) => {
       done(new Error('should not be called'));
     }, () => {
       done();
     });
 });
开发者ID:DallanQ,项目名称:rxjs,代码行数:10,代码来源:count-spec.ts


示例6: 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


示例7: it

  it('should reduce with index with seed', (done: MochaDone) => {
    const idx = [0, 1, 2, 3, 4, 5];

    range(0, 6).pipe(reduce((acc, value, index) => {
      expect(idx.shift()).to.equal(index);
      return value;
    }, -1)).subscribe(null, null, () => {
      expect(idx).to.be.empty;
      done();
    });
  });
开发者ID:DallanQ,项目名称:rxjs,代码行数:11,代码来源:reduce-spec.ts


示例8: it

  it('should not work after has been disposed', function(done) {
    const number$ = range(1, 3).pipe(concatMap(x => of(x).pipe(delay(150))));

    function app(_sources: any): any {
      return {other: number$};
    }

    const {sources, run: _run} = setup(app, {
      other: (num$: any) => from(num$).pipe(map((num: any) => 'x' + num)),
    });

    let dispose: any;
    sources.other.subscribe(function(x: any) {
      assert.notStrictEqual(x, 'x3');
      if (x === 'x2') {
        dispose();
        setTimeout(() => {
          done();
        }, 100);
      }
    });
    dispose = _run();
  });
开发者ID:ntilwalli,项目名称:cyclejs,代码行数:23,代码来源:index.ts


示例9: map

 map(function(x: any) {
   return range(x, 3);
 }),
开发者ID:angular,项目名称:zone.js,代码行数:3,代码来源:rxjs.Observable.merge.spec.ts


示例10: range

import { range } from 'rxjs';
import { filter, map, reduce, tap } from 'rxjs/operators';

// observable
const range$ = range(1, 10);

// subscription
range$
  .pipe(
    map(item => item * 10),
    filter(item => item % 20 === 0),
    reduce((accumulator, item) => accumulator + item),
    tap(sum => console.log(sum))
  )
  .subscribe();
开发者ID:jesuscc1993,项目名称:demos,代码行数:15,代码来源:operators.ts



注:本文中的rxjs.range函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript rxjs.throwError函数代码示例发布时间:2022-05-25
下一篇:
TypeScript rxjs.race函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap