本文整理汇总了TypeScript中rxjs/operators.repeat函数的典型用法代码示例。如果您正苦于以下问题:TypeScript repeat函数的具体用法?TypeScript repeat怎么用?TypeScript repeat使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了repeat函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should resubscribe multiple times', () => {
const e1 = cold('--a--b--| ');
const subs = ['^ ! ',
' ^ ! ',
' ^ ! ',
' ^ !'];
const expected = '--a--b----a--b----a--b----a--b--|';
expectObservable(e1.pipe(repeat(2), repeat(2))).toBe(expected);
expectSubscriptions(e1.subscriptions).toBe(subs);
});
示例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,
}
}