Skip to content

Instantly share code, notes, and snippets.

@OliverJAsh
Created November 15, 2014 15:10
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 OliverJAsh/a63a7572b2cb36046d5c to your computer and use it in GitHub Desktop.
Save OliverJAsh/a63a7572b2cb36046d5c to your computer and use it in GitHub Desktop.
/* jshint esnext: true */
// `getStream` is some third party thing
var stream = getStream();
var events = Rx.fromEvent(stream, 'meta');
stream.write('foo');
// meta event fired by `stream`
stream.write(null);
// When subscribing to the observable, RxJS *then* starts listening for the
// `meta` event – but it's too late because the event has already been fired!
events.subscribe(x => console.log(x));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment