Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created March 10, 2015 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattpodwysocki/c04a1d3a6ed6ec455486 to your computer and use it in GitHub Desktop.
Save mattpodwysocki/c04a1d3a6ed6ec455486 to your computer and use it in GitHub Desktop.
How do you map over a Subject?
// 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