Created
March 15, 2017 19:37
-
-
Save warash/bed508cc89adfd7516bf25df47f6bdbe to your computer and use it in GitHub Desktop.
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
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