Skip to content

Instantly share code, notes, and snippets.

@rarmatei
Created November 25, 2017 14:17
Show Gist options
  • Save rarmatei/24c910d804175138fafd6c8aa6c01a88 to your computer and use it in GitHub Desktop.
Save rarmatei/24c910d804175138fafd6c8aa6c01a88 to your computer and use it in GitHub Desktop.
class MyService3 {
constructor() {
this._producer = Rx.Observable.of(1)
.publish();
}
private _producer: Rx.ConnectableObservable<number>;
startItUp(): Rx.Observable<number> {
return Rx.Observable.create(obs => {
const subs = this._producer.subscribe(obs);
this._producer.connect();
return subs;
});
}
get passiveValues(): Rx.Observable<string> {
return this._producer.mapTo("got value");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment