[RxJS] Transformation operator: repeat
Posted Answer1215
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[RxJS] Transformation operator: repeat相关的知识,希望对你有一定的参考价值。
Operator repeat() is somewhat similar to retry(), but is not for handling operators. In this lesson we learn how repeat works.
var foo = Rx.Observable.interval(500) .zip(Rx.Observable.of(‘a‘,‘b‘,‘c‘,‘d‘), (x,y)=>y); var bar = foo.map(x => x.toUpperCase()); /* --a--b--c--d| (foo) map(toUpperCase) --A--B--C--D| (bar) repeat --A--B--C--D--A--B--C--D--A--B--C--D| */ var result = bar.repeat(3); result.subscribe( function (x) { console.log(‘next ‘ + x); }, function (err) { console.log(‘error ‘ + err); }, function () { console.log(‘done‘); }, );
以上是关于[RxJS] Transformation operator: repeat的主要内容,如果未能解决你的问题,请参考以下文章
[RxJS] Transformation operator: buffer, bufferCount, bufferTime
[RxJS] Transformation operator: map and mapTo
[RxJS] Transformation operators: delay and delayWhen