chrome.signedInDevices
Description
使用 chrome.signedInDevices
API 获取使用与当前配置文件相同的帐户登录 Chrome 的设备列表。
Permissions
signedInDevices
Availability
Dev channel
Summary
Types
Methods
Events
Types
DeviceInfo
PROPERTIES
chromeVersion
string
此设备上运行的 Chrome 版本。
id
string
此设备的唯一 ID。注意:id 只在当前设备中有意义。此 ID 不能用于从另一个设备或扩展程序引用同一设备。
name
string
设备名称。该名称通常由用户在设置设备时设置。
os
设备的操作系统。
type
设备类型。
DeviceType
TYPE
"desktop_or_laptop", "phone", "tablet", or "unknown"
OS
TYPE
"win", "mac", "linux", "chrome_os", "android", "ios", or "unknown"
Methods
get
chrome.signedInDevices.get(
isLocal?: boolean,
callback?: function,
)
Promise
获取已登录设备的数组,登录到与当前配置文件相同的帐户。
PARAMETERS
isLocal
boolean optional
如果为 true,则仅返回本地设备的信息。如果为 false 或省略,则返回包括本地设备在内的所有设备的列表。
callback
function optional
The
callback
parameter looks like:(devices: DeviceInfo[]) => void
devices
RETURNS
Promise<DeviceInfo[]>
这仅在未指定回调参数时返回 Promise,并且使用 MV3+。 Promise 中的类型与回调的第一个参数相同。
Events
onDeviceInfoChange
chrome.signedInDevices.onDeviceInfoChange.addListener(
callback: function,
)
当任何已登录设备的 DeviceInfo 对象发生更改或添加或删除设备时触发。
PARAMETERS
callback
function
The
callback
parameter looks like:(devices: DeviceInfo[]) => void
devices
By.一粒技术服务.