Electron JS-深度链接-如何使用深度链接的示例 [英] Electron JS - Deep Linking - Example of how to use deep linking

查看:145
本文介绍了Electron JS-深度链接-如何使用深度链接的示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Electron JS中,我为Windows创建了一个应用程序,并注册了自己的协议以进行深层链接。单击我的链接 ludo:// play?level = 1234 时,应用程序会正确打开。没问题。但是,我不知道如何在应用程序内部检索深层链接。 app.setAsDefaultProtocolClient 的文档中提到了这句话:

In Electron JS, I created an app for Windows and registered my own protocol for deep linking. The app properly opens when clicking on my link ludo://play?level=1234. No problem there. However I don't know how to retrieve the deep link inside of my app. The docs for app.setAsDefaultProtocolClient mention this sentence:

整个链接(包括协议)将作为参数传递给您的应用程序。

有人可以告诉我如何找回它吗?因为它不在 process.argv 中,也不在 process.execPath process中。 execArgv

Can anyone tell me how to retrieve that? Because it is not in process.argv nor is it in process.execPath or process.execArgv.

应用启动时可以在回调中传递吗?

Could it be passed in a callback when the app starts? Any help on this would be great.

推荐答案

在macOS上,您需要收听 app.open-url 事件 ,而在Windows上,该URL应该在 process.argv (在主进程中)中可用。

On macOS you need to listen to the app.open-url event, while on Windows the url should be available in process.argv (in the main process).

这篇关于Electron JS-深度链接-如何使用深度链接的示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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