1. 面向开发者的 Web 技术
  2. Web API
  3. BluetoothRemoteGATTCharacteristic
  4. writeValue()

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

View in English Always switch to English

BluetoothRemoteGATTCharacteristic:writeValue() 方法

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

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

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

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

语法

js
writeValue(value)

参数

value

ArrayBufferTypedArrayDataView

返回值

Promise

规范

规范
Web Bluetooth
# dom-bluetoothremotegattcharacteristic-writevalue

浏览器兼容性

帮助改进 MDN

了解如何参与贡献

此页面最后更新于 ,由 MDN 贡献者更新。

AltStyle によって変換されたページ (->オリジナル) /