本文整理匯總了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,
}
}