console
const { range, fromEvent, interval } = rxjs;
const { map, filter, flatMap, switchMap, mergeMap } = rxjs.operators;
const length = document.getElementById('length');
const width = document.getElementById('width');
const length$ = fromEvent(length, 'keyup')
.pipe(mergeMap(_ => {
return interval(1000);
}));
const width$ = fromEvent(width, 'keyup')
.pipe(switchMap(_ => {
return interval(1000);
}));
length$.subscribe(l => {
console.log(l);
});
width$.subscribe(w => console.log(w));
长度:<input type="text" id="length" /><br>
宽度:<input type="text" id="width" />