如何调试可观察者是否取消订阅 [英] How to debug on whether observable is unsubscribe
本文介绍了如何调试可观察者是否取消订阅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在订阅后测试可观察对象是否已取消订阅. 我正在使用ionic2/angular2开发.
how can i test whether the observable is unsubscribe after subscription. I am developing in ionic2/angular2.
我希望在chrome开发人员模式下输入类似这样的内容,它将返回值:
observableName.isSubscribe()
I am expecting typing something like this in chrome developer mode and it will return value:
observableName.isSubscribe()
推荐答案
您可以订阅并检查封闭参数.
You can have a subscription and check closed parameter.
let subscription = observable.subscribe(() => {})
if (!subscription.closed) {
//subscribed
} else {
//not subscribed
}
这篇关于如何调试可观察者是否取消订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文