[RxJS] Add debug method to Observable in TypeScript
Observable.prototype.debug = function(message: any) {
return this.do(
(next) => {
if(!environment.production) {
console.log(message, next);
}
},
(err) => {
if(!environment.production) {
console.error(message, err)
}
},
() => {
if(!environment.production) {
console.info("Observable completed", message)
}
}
);
};
declare module 'rxjs/observable' {
interface Observable<T> {
debug: (...any) => Observable<T>
}
}
[RxJS] Add debug method to Observable in TypeScript的更多相关文章
- [Javascript + rxjs] Using the map method with Observable
Like an array, Observable has a map method that allows us to transform a sequence into a new Observa ...
- [RxJS] `add` Inner Subscriptions to Outer Subscribers to `unsubscribe` in RxJS
When subscribers create new "inner" sources and subscriptions, you run the risk of losing ...
- [RxJS] Flatten a higher order observable with concatAll in RxJS
Besides switch and mergeAll, RxJS also provides concatAll as a flattening operator. In this lesson w ...
- [RxJS] Flatten a higher order observable with mergeAll in RxJS
Among RxJS flattening operators, switch is the most commonly used operator. However, it is important ...
- [RxJS] Subject asObservable() method
You can create your own state store, not using any state management libraray. You might have seen th ...
- Debug method
#define DEBUG(format,...) printf("Ray.he file:"__FILE__" func:%s() line:%d, print &qu ...
- angular2 学习笔记 ( rxjs 流 )
RxJS 博大精深,看了好几篇文章都没有明白. 范围牵扯到了函数响应式开发去了... 我对函数式一知半解, 响应式更是第一次听到... 唉...不过日子还是得过...混着过先呗 我目前所理解的很浅, ...
- RxJS -- Subscription
Subscription是什么? 当subscribe一个observable的时候, 返回的就是一个subscription. 它是一个一次性对象(disposable), 它有一个非常重要的方法 ...
- 构建具有用户身份认证的 Ionic 应用
序言:本文主要介绍了使用 Ionic 和 Cordova 开发混合应用时如何添加用户身份认证.教程简易,对于 Ionic 入门学习有一定帮助.因为文章是去年发表,所以教程内关于 Okta 的一些使用步 ...
随机推荐
- python绘图问题
论文绘图整理 # coding: utf-8 #来源:https://blog.csdn.net/A_Z666666/article/details/81165123 import matplotli ...
- Node里面的对象创建问题
1.利用new Object()创建时 var a =new Object() a.b = 1 console.log(a) // 打印出来是[object Object] console.log(J ...
- 洛谷 P3654 First Step (ファーストステップ)
洛谷 P3654 First Step (ファーストステップ) https://www.luogu.org/problemnew/show/P3654 题目描述 可是……这个篮球场,好像很久没有使用过 ...
- KNIMI数据挖掘建模与分析系列_002_利用KNIMI做商超零售关联推荐
利用KNIMI做商超零售关联推荐 http://blog.csdn.net/shuaihj 一.測试数据 须要測试数据,请留下邮箱 二.训练关联推荐规则 1.读取销售记录(sales.table) 2 ...
- uva 10098 Generating Fast(全排列)
还是用的两种方法,递归和STL,递归那个是含有反复元素的全排列,这道题我 没有尝试没有反复元素的排列,由于从题目上并没有发现一定是有反复元素的() 贴代码: <span style=" ...
- Android Set与List之间转化
List list = new ArrayList(set); Set set = new HashSet(list); //但是有一点,转换当中可能要丢失数据,尤其是从list转换到set的时候,因 ...
- Altium Designer如何创建类,如何修改线宽
如果线宽还是没有改变,就是因为,有一个默认的class,它的规则优先级要高于PWR
- (转)kvm虚拟机中,如何给子系统更换光盘
转自:http://www.cnblogs.com/york-hust/archive/2012/06/12/2546334.html 启动kvm后,在kvm窗口中,按下CTRL+ALT+2,切换至q ...
- 清除浮动.md
清除浮动的三种方法 1 加空div层(.clear) 2 overflow属性设置(.clearo) 3 :after伪元素(.clearfix) <!DOCTYPE html> < ...
- 【习题 3-3 UVA-1225】Digit Counting
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 水模拟 [代码] #include <bits/stdc++.h> using namespace std; int a ...