mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 01:23:52 +00:00
Update @types/web-bluetooth
Now includes writeValueWithResponse and writeValueWithoutResponse
This commit is contained in:
committed by
David Lechner
parent
70d98511c2
commit
5c3727b3ce
@@ -7,8 +7,6 @@
|
||||
*/
|
||||
export interface PolyfillBluetoothRemoteGATTCharacteristic
|
||||
extends BluetoothRemoteGATTCharacteristic {
|
||||
writeValueWithResponse?(value: BufferSource): Promise<void>;
|
||||
writeValueWithoutResponse?(value: BufferSource): Promise<void>;
|
||||
/**
|
||||
* Calls writeValueWithResponse() if available otherwise falls back to writeValue()
|
||||
* @param value data to send
|
||||
@@ -30,9 +28,8 @@ export function polyfillBluetoothRemoteGATTCharacteristic(
|
||||
char: BluetoothRemoteGATTCharacteristic,
|
||||
): PolyfillBluetoothRemoteGATTCharacteristic {
|
||||
const polyfill = (char as unknown) as PolyfillBluetoothRemoteGATTCharacteristic;
|
||||
polyfill.xWriteValueWithResponse =
|
||||
polyfill.writeValueWithResponse || char.writeValue;
|
||||
polyfill.xWriteValueWithResponse = char.writeValueWithResponse || char.writeValue;
|
||||
polyfill.xWriteValueWithoutResponse =
|
||||
polyfill.writeValueWithoutResponse || char.writeValue;
|
||||
char.writeValueWithoutResponse || char.writeValue;
|
||||
return polyfill;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user