Last active
January 13, 2021 19:20
-
-
Save akatakritos/a66a2f91ecb05cb50860e703026b372b to your computer and use it in GitHub Desktop.
rxjs debug 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
export function debug<T>(label: string) { | |
return tap<T>( | |
next => console.log(`[${label}]`, next), | |
err => console.error(`[${label} -- ERR]`, err), | |
() => console.log(`[${label}]`, 'complete') | |
); | |
} | |
/* | |
Use: | |
obs$.pipe( | |
debug('obs$'), | |
switchMap(v => this.load(v)), | |
debug('load') | |
); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment