此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

BluetoothRemoteGATTCharacteristic:writeValue() 方法

已弃用: 不再推荐使用该特性。虽然一些浏览器仍然支持它,但也许已从相关的 web 标准中移除,也许正准备移除或出于兼容性而保留。请尽量不要使用该特性,并更新现有的代码;参见本页面底部的兼容性表格以指导你作出决定。请注意,该特性随时可能无法正常工作。

安全上下文: 此特性仅在一些支持的浏览器安全上下文(HTTPS)中可用。

请改用 BluetoothRemoteGATTCharacteristic.writeValueWithResponse()BluetoothRemoteGATTCharacteristic.writeValueWithoutResponse()

BluetoothRemoteGATTCharacteristic.writeValue() 方法将一个 BluetoothRemoteGATTCharacteristic 对象的 value 属性设置为给定的 ArrayBuffer 中包含的字节,使用可选响应写入特性值,并返回 Promise