我有一个流需要跳过而bool是真的。
但是,当bool设置为false时,我需要应用跳过时丢失的最后一个流值。
.site-inner, .wrap {
margin: 0 auto;
max-width: 1100px;
}
.cubutton {
display: block;
box-sizing: border-box;
border-radius: 99999px;
background-color: #44ace8;
color: #fff;
cursor: pointer;
font-family: 'Quicksand', sans-serif;
font-size: 20px;
font-size: 2.0rem;
font-weight: 700;
text-align: center;
letter-spacing: 1px;
padding: 20px 40px 20px 40px;
margin-left: auto;
margin-right: auto;
margin-top: 25px;
margin-bottom: 25px;
width: 100%;
text-transform: uppercase;
-webkit-font-smoothing: antialiased;
-webkit-box-shadow: 4px 4px 5px 0px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 4px 4px 5px 0px rgba(50, 50, 50, 0.75);
box-shadow: 4px 4px 5px 0px rgba(50, 50, 50, 0.75);
-webkit-transition: all 0.1s ease-in-out;
-moz-transition: all 0.1s ease-in-out;
-ms-transition: all 0.1s ease-in-out;
-o-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
答案 0 :(得分:0)
使用多播共享开始和其余值。 pairwise to pairt prev和next value and concat to begin start and the rest。
Rx.Observable.interval(500)
.multicast(new Rx.Subject(), shared => {
let start$ = shared
.pairwise()
.skipWhile((x)=>x[1]<5) // this is the condition to skip
.first()
.switchMap(el=>Rx.Observable.concat(Rx.Observable.of(el[0]),
Rx.Observable.of(el[1])));
return Rx.Observable.concat(start$, shared);
}).subscribe(x=>console.log(x));