Skip to content

Instantly share code, notes, and snippets.

@mrspeaker
Created August 2, 2015 16:19
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 mrspeaker/6aec4434c486a000a464 to your computer and use it in GitHub Desktop.
Save mrspeaker/6aec4434c486a000a464 to your computer and use it in GitHub Desktop.
Plain functions as RxJS Subjects
import Rx from 'rx';
const RxFuncSubject = () => {
const subject = Object.assign(
(...args) => subject.onNext(...args),
Rx.Observable.prototype,
Rx.Subject.prototype);
Rx.Subject.call(subject);
return subject;
};
export default RxFuncSubject;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment