Skip to content

Instantly share code, notes, and snippets.

@mason276752
Last active March 15, 2018 03:39
Show Gist options
  • Save mason276752/f903d29225c3ff2804d684c12fe096ba to your computer and use it in GitHub Desktop.
Save mason276752/f903d29225c3ff2804d684c12fe096ba to your computer and use it in GitHub Desktop.
rxjs operator
function log() {
return Rx.Observable.create((observer) => {
return this.subscribe(
(value) => {
console.log(value);
try {
observer.next(value);
} catch (e) {
observer.error(e);
}
},
(err) => {
console.log(err);
observer.error(err);
},
() => {
observer.complete();
}
);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment