React native - Programmatically check if in remote JS debugging is enabled

后端 未结 7 779
小蘑菇
小蘑菇 2021-02-01 19:04

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

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

7条回答
  •  执念已碎
    2021-02-01 19:36

    A class DedicatedWorkerGlobalScope exists iff remote debugging is enabled (it is the constructor of global object in that case). Thus we can:

    const haveRemoteDev = (typeof DedicatedWorkerGlobalScope) !== 'undefined';
    

提交回复
热议问题