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的更多相关文章

  1. [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 ...

  2. [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 ...

  3. [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 ...

  4. [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 ...

  5. [RxJS] Subject asObservable() method

    You can create your own state store, not using any state management libraray. You might have seen th ...

  6. Debug method

    #define DEBUG(format,...) printf("Ray.he file:"__FILE__" func:%s() line:%d, print &qu ...

  7. angular2 学习笔记 ( rxjs 流 )

    RxJS 博大精深,看了好几篇文章都没有明白. 范围牵扯到了函数响应式开发去了... 我对函数式一知半解, 响应式更是第一次听到... 唉...不过日子还是得过...混着过先呗 我目前所理解的很浅,  ...

  8. RxJS -- Subscription

    Subscription是什么? 当subscribe一个observable的时候, 返回的就是一个subscription. 它是一个一次性对象(disposable), 它有一个非常重要的方法 ...

  9. 构建具有用户身份认证的 Ionic 应用

    序言:本文主要介绍了使用 Ionic 和 Cordova 开发混合应用时如何添加用户身份认证.教程简易,对于 Ionic 入门学习有一定帮助.因为文章是去年发表,所以教程内关于 Okta 的一些使用步 ...

随机推荐

  1. python学习三:列表,元组

    1.列表: 1.列表的定义方式: list1 = [1,2,3,4,"hello","world"] 如上所示,list1就是一个列表,列表的内容以中括号包含起 ...

  2. 进阶攻略|最全的前端开源JS框架和库

    新的 Javascript 库层出不穷,从而Web 社区愈发活跃.多样.在多方面快速发展.详细去描述每一种主流的 Javascript框架和库近乎不可能,所以在这篇文章中主要介绍一些对前端发展最具影响 ...

  3. 怎样将OpenStack部署到Hadoop

    随着信息时代的快速发展,大数据技术和私有云环境都非常实用;只是,假设将两者结合在一起.企业会获得巨大的利润.虽然结合两者会让环境变得更复杂.企业仍然能够看到将 OpenStack 私有云和 Apach ...

  4. android 4.4 添加物理按键

    kernel下添加 Linux-3.4/drivers/input/keyboard/Makefile linux-3.4/drivers/input/keyboard/sw-keyboard.c s ...

  5. python3对序列求绝对值

    http://www.cnblogs.com/itdyb/p/5731804.html     一开始我是这样写的,据说这样写python2是可以的: myList = [-1,2,-3,4,-5,6 ...

  6. 学习笔记:Vue——组件和Prop

    前言:这一篇是关于组件基础.组件注册.Prop等内容. 1.组件基础 01.组件是可复用的Vue实例 02.组件中的data选项必须是一个函数 03.一个组件默认可以有任意数量的prop 任何值都可以 ...

  7. QQ群功能设计与心理学

    刚刚在一个Java技术交流群,发了个 "博客投票"的广告. 群主两眼一黑,瞬间就把我给干掉了. 看到QQ给出的系统消息,发现QQ群的一个功能做得很不错. 大家注意到,右边有个&qu ...

  8. Codeforces #144 (Div. 1) B. Table (组合数学+dp)

    题目链接: B.Table 题意: \(n*m\)的矩阵使每个\(n*n\)矩阵里面准确包含\(k\)个点,问你有多少种放法. \((1 ≤ n ≤ 100; n ≤ m ≤ 10^{18}; 0 ≤ ...

  9. JS实现穿墙效果(判断鼠标划入划出的方向)

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  10. WSDL文档框架