var sourceInit = Rx.Observable.timer(0, 1000)
.do(x => console.log('timer', x))
let source = sourceInit.map(x => x*10)
source.subscribe(x => {
console.log('x', x)
})
source.subscribe(x => {
console.log('x2', x)
})
Die outpu ich habe:Rxjs loszuwerden Doppel Abonnement
timer 0
x 0
timer 0
x2 0
timer 1
x 10
timer 1
x2 10
timer 2
x2 20
timer 2
ich nur einzelne Abonnement-Timer und eine Ausgabe wie diese haben müssen:
timer 0
x 0
x2 0
timer 1
x 10
x2 10
timer 2
x 20
x2 20
Was die richtige ist Ansatz für dieses Problem sollte sein?
bekam ich mit diesem Ansatz Thema mit:
var sourceInit = Rx.Observable.timer(0, 1000)
.do(x => console.log('timer', x))
var source = new Rx.Subject();
sourceInit.subscribe(source)
source.subscribe(x => {
console.log('x', x)
})
source.subscribe(x => {
console.log('x2', x)
})
Ist es richtig, und man nur?