[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 的一些使用步 ...
随机推荐
- JS 实现图片模态框,幻灯片,跑马灯功能
网站中常用的幻灯片和模态框,使用 HTML.JavaScript 与 CSS 来创建 Lightbox,类似相册预览功能.可以运用到视频网站,商城,相册上去 参考了菜鸟教程,有兴趣自己去看 HTML/ ...
- 3/21 Django框架 模板路径及模板过滤器 1.模板路径查找
3/21 Django框架 模板路径及模板过滤器 1.模板路径查找 先找settings.py里的TEMPLATES列表下的DIRS路径.如果APP_DIRS为True,还会到注册了的APP文件夹下依 ...
- UML类图与类图中的关系
以下内容摘自<Java与模式> 在类与类之间,会有连线指明它们之间的关系.类和类.类和接口.接口和接口之间可以建立以下几种关系:一般化关系.关联关系.聚合关系.合成关系和依赖关系,这几种关 ...
- ActivityChooserView-如何隐藏选择的应用图标
今天在修改一个问题的时候,用到了ActivityChooserView类,但是,这个类会自动显示两个按钮,一个是点击有下拉框的,一个是选择应用以后,显示应用图标的.因为应用图标跟当时的环境非常的不搭, ...
- DBLINK做系统集
过度使用DBLINK做系统集成会带来的问题 过度使用DBLINK做系统集成会带来很多问题,问题主要由以下几点: 1. 大量消耗数据库资源: 本地系统每通过DBLINK链接远端系统一次,都会生成一个本地 ...
- js面向对象2--原型
一.原型和原型对象 函数的原型prototype:函数才有prototype,prototype是一个对象,指向了当前构造函数的引用地址. 所有对象都有__proto__属性, 所有的__proto ...
- PDF.Js的使用—javascript中前端显示pdf文件
PDF.Js的使用—javascript中前端显示pdf文件 写于2018/12/6 起因是一个图片展示页面需要展示pdf格式的文件,所以查了半天决定使用pdf.js,我也不求有多了解它,能实现我想要 ...
- COGS——C 14. [网络流24题] 搭配飞行员
http://cogs.pro/cogs/problem/problem.php?pid=14 ★★☆ 输入文件:flyer.in 输出文件:flyer.out 简单对比时间限制:1 s ...
- CODEVS——T 1993 草地排水 USACO
http://codevs.cn/problem/1993/ 时间限制: 2 s 空间限制: 256000 KB 题目等级 : 钻石 Diamond 题解 查看运行结果 题目描述 De ...
- [D3] Adding Arrows to Links
svg.append('defs').selectAll('marker') .data(['end']).enter() .append('marker') .attr('id', String) ...