Skip to content

Instantly share code, notes, and snippets.

@akatakritos
Last active January 13, 2021 19:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akatakritos/a66a2f91ecb05cb50860e703026b372b to your computer and use it in GitHub Desktop.
Save akatakritos/a66a2f91ecb05cb50860e703026b372b to your computer and use it in GitHub Desktop.
rxjs debug operator
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