Last active
March 15, 2018 03:39
-
-
Save mason276752/f903d29225c3ff2804d684c12fe096ba to your computer and use it in GitHub Desktop.
rxjs operator
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
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