How do I define operators on an RX subject? I want to be able to throttle/take/debounce a data stream without changing the original source stream. ive tried the following (broken) implementation. any help appreciated.
var source = Rx.Observable.interval(1000).take(10);
var subject = new Rx.Subject();
source.subscribe(subject);
var subscriber1 = subject.subscribe(
function (x) { $("#result1").append('next: ' + x + '<br>'); },
function (e) { $("#result1").append('onError: ' + e.message); },
function () { $("#result1").append('onCompleted'); });
var modified = new Rx.Subject().take(2); // ... or throttle, or debounce etc
source.subscribe(modified);
var subscriber2 = modified.subscribe(
function (x) { $("#result2").append('next: ' + x + '<br>'); },
function (e) { $("#result2").append('onError: ' + e.message); },
function () { $("#result2").append('onCompleted'); });