Created
March 10, 2015 21:23
-
-
Save mattpodwysocki/c04a1d3a6ed6ec455486 to your computer and use it in GitHub Desktop.
How do you map over a Subject?
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
// Create a single subject for all emitting of data | |
var subject = new Rx.Subject(); | |
// Create something just for mapping | |
var obs = subject.map(function(message) { | |
return message + ' dawg.'; | |
}); | |
// Subscribe to that | |
obs.subscribe(function(message) {console.log(message);}); | |
// Send data to the subject | |
subject.onNext('next!'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment