简体   繁体   English

如何从我的本机应用程序(如远程调试)打开笔记本电脑上的 chrome 选项卡?

[英]How can I open a chrome tab on my laptop from my react-native app (like remote debugging does)?

I am creating a small debugging app to monitor a particular interaction (WebRTC) between two users of my main app.我正在创建一个小型调试应用程序来监视我的主应用程序的两个用户之间的特定交互 (WebRTC)。

I have a web app (React) and a mobile app (React-Native) that each connect through socket.io to a node server I created.我有一个 Web 应用程序 (React) 和一个移动应用程序 (React-Native),它们都通过 socket.io 连接到我创建的节点服务器。 This node server's purpose is to collect information from both users, and display this information in a web page in real time.该节点服务器的目的是收集双方用户的信息,并将这些信息实时显示在网页中。

My web app has a button that when you click it it opens up that debugging web page in a new tab with the debugging information;我的 Web 应用程序有一个按钮,当您单击它时,它会在包含调试信息的新选项卡中打开该调试网页; I just use window.open .我只是使用window.open Is it possible to do something similar from my mobile device, running a react-native application?是否可以从我的移动设备上执行类似的操作,运行 react-native 应用程序? That is, can I click a button and have a browser tab open on my laptop somehow?也就是说,我可以单击一个按钮并以某种方式在我的笔记本电脑上打开一个浏览器选项卡吗? Does React-Native remote debugging work with something like this? React-Native 远程调试是否适用于这样的事情?

There is currently no supported way you can do this in React Native.目前在 React Native 中没有支持的方法可以做到这一点。

However, you can certainly add it yourself.但是,您当然可以自己添加它。

Navigate to node_modules/react-native/local-cli/server/middleware/getDevToolsMiddleware.js导航到node_modules/react-native/local-cli/server/middleware/getDevToolsMiddleware.js

Look for launchChrome(debuggerURL);寻找launchChrome(debuggerURL); , you can invoke another launchChrome function with your desired URL. ,您可以使用所需的 URL 调用另一个launchChrome函数。

This will only appear when you select Debug JS Remotely .这只会在您选择Debug JS Remotely时出现。

You can configure the CLI server code more to launch the URL when you are not debugging.调试时,您可以配置 CLI 服务器代码以启动 URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在IOS中从我的React-Native应用程序打开外部应用程序? - How can I open a external App from my React-Native App in IOS? 我如何在笔记本电脑上运行 NPX react-native - How do i run NPX react-native on my laptop 由于 avd 太慢,我如何在我的手机上运行 react-native 应用程序 - How Can I run react-native app in my mobile because avd is too slow 如何在 react-native 中修复我的延迟文本输入 - How can i fix my laggy textinput in react-native 如何使我的应用程序响应所有手机? 反应本机 - How can I do to make my app responsive to all phones? REACT-NATIVE 如何从我的 WebView 中触发回 react-native 的动作? - How can I trigger action back in the react-native from my WebView? 如何检查我的 React-Native 应用程序是在网络浏览器中运行还是在 ios/android 应用程序中运行? - How can I check if my React-Native app is running in a web broswer vs running in an ios/android app? React-Native - 当我关闭像信使这样的应用程序时,我怎么可能仍然收到来自其他人的来电通知 - React-Native - How is it possible that when I close an app like messenger I can still receive incoming call notifications from others 如何在模拟器中打开 react-native 应用程序? - How do I open react-native app in emulator? React-Native 如何将我的 json 数据返回到我的道具? - React-Native how can i return my json data to my prop?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM