本文整理汇总了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;未经允许,请勿转载。 |
请发表评论