答案 0 :(得分:0)
以下是RxJS 4文档的示例: https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/thendo.md
var selector = function (x, y) { return x + ", " + y; };
var source = Rx.Observable.when(
Rx.Observable.interval(250).and(Rx.Observable.of("A", "B", "C")).thenDo(selector),
Rx.Observable.interval(300).and(Rx.Observable.of("a", "b")).thenDo(selector)
);
var subscription = source.subscribe(
function (x) {
console.log('Next: ' + x);
},
function (err) {
console.log('Error: ' + err);
},
function () {
console.log('Completed');
});
// => Next: 0, A
// => Next: 0, a
// => Next: 1, B
// => Next: 1, b
// => Next: 2, C
// => Completed