Created
March 6, 2012 08:01
-
-
Save cburgdorf/1984825 to your computer and use it in GitHub Desktop.
Rx bug?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var subject = new Rx.Subject(); | |
var getObservable = function (eventName) { | |
return subject.asObservable() | |
.where(function (x) { return x.EventName === eventName; }) | |
.takeUntil(function (x) { return x.Type === "onComplete"; }) | |
.selectMany(function (x) { | |
return x.Type === "onNext" ? Rx.Observable.returnValue(x.Data) : | |
x.Type === "onError" ? Rx.Observable.throwException(x.Data) : | |
Rx.Observable.empty(); | |
}); | |
} | |
getObservable("SomethingHappened").subscribe(function(x){ console.log("onNext" + x); }, function(x){ console.log("onError" + x); }, function(){ console.log("onComplete");}) | |
This throws: | |
TypeError: Object function (x) { return x.Type === "onComplete"; } has no method 'materialize' | |
as soon as I put in the takeUntil. If I leave it out, everything works as expected. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment