Skip to content

Instantly share code, notes, and snippets.

@warash
Created March 15, 2017 19:37
Show Gist options
  • Save warash/bed508cc89adfd7516bf25df47f6bdbe to your computer and use it in GitHub Desktop.
Save warash/bed508cc89adfd7516bf25df47f6bdbe to your computer and use it in GitHub Desktop.
import { Observable } from 'rxjs/Observable';
import { environment } from '../../environments/environment';
declare module 'rxjs/Observable' {
interface Observable<T> {
debug: (...any) => Observable<T>;
}
}
Observable.prototype.debug = (message: string) => {
return this.do(
(next) => {
if (!environment.production) {
console.log(message, next);
}
},
(err) => {
if (!environment.production) {
console.error('ERROR >>> ', message, err);
}
},
() => {
if (!environment.production) {
console.log('Completed');
}
}
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment