React native - 以编程方式检查是否启用了远程 JS 调试 [英] React native - Programmatically check if in remote JS debugging is enabled

查看:36
本文介绍了React native - 以编程方式检查是否启用了远程 JS 调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 React-Native 上,我如何知道 "Debug JS Remotely" 是否已启用?

On React-Native, how can I know if "Debug JS Remotely" is enabled?

我尝试查看 RN 文档 和各种 NPM 包,但是不知道怎么...

I tried looking in RN docs and various NPM packages, but couldn't find out how...

推荐答案

如何以编程方式检查是否启用了远程调试(今天刚刚在另一个 SO 问题上发现了这种特殊行为).在 RN 0.43 和 Chrome 调试器 + React Native Debugger 上测试:

How to programmatically check if remote debugging is enabled (just found this peculiar behaviour today on another SO question). Tested on RN 0.43 and with Chrome debugger + React Native Debugger :

const isDebuggingEnabled = (typeof atob !== 'undefined');

刚刚注意到半年前有人问过这个问题:D...好吧,我把它留在这里给后代.

just noticed this was asked over half a year ago :D... well, I leave it here for future generations.

这篇关于React native - 以编程方式检查是否启用了远程 JS 调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆