說明
使用 chrome.system.network
API。
權限
system.network
類型
NetworkInterface
屬性
-
地址
字串
可用的 IPv4/6 位址。
-
名稱
字串
介面的基礎名稱。在 *nix 上,這通常是「eth0」、「wlan0」等。
-
prefixLength
數字
前置字串長度
方法
getNetworkInterfaces()
Promise
chrome.system.network.getNetworkInterfaces(
callback?: function,
): Promise<NetworkInterface[]>
擷取這個系統上本機介面的相關資訊。
參數
-
callback
函式 選用
callback
參數如下:(networkInterfaces: NetworkInterface[]) => void
-
networkInterfaces
包含網路介面資訊的物件陣列。
-
傳回
-
Promise<NetworkInterface[]>
Chrome 91 以上版本只有資訊清單 V3 以上版本支援 Promise,其他平台則需使用回呼。