Electron 电子获取互联网连接类型

Electron 电子获取互联网连接类型,electron,Electron,根据,navigator.connection应该具有类型属性。但是,当我在我的电子应用程序中输出navigator.connection时,我得到: { downlink: 10, effectiveType: "4g", onchange: null, rtt: 0, saveData: false } 我需要知道用户是否连接到以太网或无线。还有别的办法吗 我安装了electron3.0.4。我最终使用了一个节点包来检测网络类型 const netw

根据,
navigator.connection
应该具有
类型
属性。但是,当我在我的电子应用程序中输出
navigator.connection
时,我得到:

{
    downlink: 10,
    effectiveType: "4g",
    onchange: null,
    rtt: 0,
    saveData: false
}
我需要知道用户是否连接到
以太网
无线
。还有别的办法吗


我安装了electron
3.0.4

我最终使用了一个节点包来检测网络类型

const network = require('network');
network.get_active_interface(function(err, obj) {
    // obj.type is the network type
    // 'Wireless' for wifi
    // 'Wired' for ethernet 
});

navigator.connection是一项实验性功能。而且它甚至不包括在Chrome引擎中。这就是为什么你看不到它的原因。@KashifSiddiqui很酷,还有其他方法来获取连接类型吗?