@types/web-bluetooth
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -6,2 +6,3 @@ // Type definitions for Web Bluetooth | ||
// Rob Moran <https://github.com/thegecko> | ||
// David Bjerremose <https://github.com/DaBs> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -13,18 +14,2 @@ | ||
interface BluetoothRequestDeviceFilter { | ||
services?: BluetoothServiceUUID[] | undefined; | ||
name?: string | undefined; | ||
namePrefix?: string | undefined; | ||
manufacturerId?: number | undefined; | ||
serviceDataUUID?: BluetoothServiceUUID | undefined; | ||
} | ||
type RequestDeviceOptions = { | ||
filters: BluetoothRequestDeviceFilter[]; | ||
optionalServices?: BluetoothServiceUUID[] | undefined; | ||
} | { | ||
acceptAllDevices: boolean; | ||
optionalServices?: BluetoothServiceUUID[] | undefined; | ||
}; | ||
type BluetoothManufacturerData = Map<number, DataView>; | ||
@@ -34,13 +19,13 @@ type BluetoothServiceData = Map<BluetoothServiceUUID, DataView>; | ||
interface BluetoothDataFilter { | ||
readonly dataPrefix: DataView; | ||
readonly mask: DataView; | ||
readonly dataPrefix?: BufferSource | undefined; | ||
readonly mask?: BufferSource | undefined; | ||
} | ||
interface BluetoothManufacturerDataFilter { | ||
readonly [manufacturerId: number]: BluetoothDataFilter; | ||
interface BluetoothManufacturerDataFilter extends BluetoothDataFilter { | ||
companyIdentifier: number; | ||
} | ||
type BluetoothServiceDataFilter = { | ||
readonly [serviceUUID in BluetoothServiceUUID]: BluetoothDataFilter; | ||
}; | ||
interface BluetoothServiceDataFilter extends BluetoothDataFilter { | ||
service: BluetoothServiceUUID; | ||
} | ||
@@ -51,7 +36,7 @@ interface BluetoothLEScanFilter { | ||
readonly services?: BluetoothServiceUUID[] | undefined; | ||
readonly manufacturerData?: BluetoothManufacturerDataFilter | undefined; | ||
readonly serviceData?: BluetoothServiceDataFilter | undefined; | ||
readonly manufacturerData?: BluetoothManufacturerDataFilter[] | undefined; | ||
readonly serviceData?: BluetoothServiceDataFilter[] | undefined; | ||
} | ||
interface RequestLEScanOptions { | ||
interface BluetoothLEScanOptions { | ||
readonly filters?: BluetoothLEScanFilter[] | undefined; | ||
@@ -62,3 +47,3 @@ readonly keepRepeatedDevices?: boolean | undefined; | ||
interface BluetoothLEScan extends RequestLEScanOptions { | ||
interface BluetoothLEScan extends BluetoothLEScanOptions { | ||
active: boolean; | ||
@@ -68,9 +53,21 @@ stop: () => void; | ||
interface BluetoothAdvertisementEvent extends Event { | ||
device: BluetoothDevice; | ||
rssi: number; | ||
txPower: number; | ||
manufacturerData?: BluetoothManufacturerData | undefined; | ||
serviceData?: BluetoothServiceData | undefined; | ||
uuids?: BluetoothServiceUUID[] | undefined; | ||
type RequestDeviceOptions = { | ||
filters: BluetoothLEScanFilter[]; | ||
optionalServices?: BluetoothServiceUUID[] | undefined; | ||
optionalManufacturerData?: number[] | undefined; | ||
} | { | ||
acceptAllDevices: boolean; | ||
optionalServices?: BluetoothServiceUUID[] | undefined; | ||
optionalManufacturerData?: number[] | undefined; | ||
}; | ||
interface BluetoothAdvertisingEvent extends Event { | ||
readonly device: BluetoothDevice; | ||
readonly uuids: BluetoothServiceUUID[]; | ||
readonly manufacturerData: BluetoothManufacturerData; | ||
readonly serviceData: BluetoothServiceData; | ||
readonly name?: string | undefined; | ||
readonly appearance?: number | undefined; | ||
readonly rssi?: number | undefined; | ||
readonly txPower?: number | undefined; | ||
} | ||
@@ -103,3 +100,3 @@ | ||
interface BluetoothRemoteGATTCharacteristic extends EventTarget, CharacteristicEventHandlers { | ||
readonly service?: BluetoothRemoteGATTService | undefined; | ||
readonly service: BluetoothRemoteGATTService; | ||
readonly uuid: string; | ||
@@ -173,5 +170,5 @@ readonly properties: BluetoothCharacteristicProperties; | ||
requestDevice(options?: RequestDeviceOptions): Promise<BluetoothDevice>; | ||
requestLEScan(options?: RequestLEScanOptions): Promise<BluetoothLEScan>; | ||
requestLEScan(options?: BluetoothLEScanOptions): Promise<BluetoothLEScan>; | ||
addEventListener(type: "availabilitychanged", listener: (this: this, ev: Event) => any, useCapture?: boolean): void; | ||
addEventListener(type: "advertisementreceived", listener: (this: this, ev: BluetoothAdvertisementEvent) => any, useCapture?: boolean): void; | ||
addEventListener(type: "advertisementreceived", listener: (this: this, ev: BluetoothAdvertisingEvent) => any, useCapture?: boolean): void; | ||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; | ||
@@ -178,0 +175,0 @@ } |
{ | ||
"name": "@types/web-bluetooth", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "TypeScript definitions for Web Bluetooth", | ||
@@ -21,2 +21,7 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/web-bluetooth", | ||
"githubUsername": "thegecko" | ||
}, | ||
{ | ||
"name": "David Bjerremose", | ||
"url": "https://github.com/DaBs", | ||
"githubUsername": "DaBs" | ||
} | ||
@@ -33,4 +38,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "dbd7647949d9e991cd843d44b0f9018ddec80037ae0d5f3746c68037b8c0c8be", | ||
"typesPublisherContentHash": "95aba9aa4635fee1bad80ff86415a2fe9c6fde58343eed029c6fd7a81eedcd5b", | ||
"typeScriptVersion": "3.6" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Fri, 02 Jul 2021 18:05:18 GMT | ||
* Last updated: Wed, 18 Aug 2021 16:31:22 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by [Uri Shaked](https://github.com/urish), [Xavier Lozinguez](http://github.com/xlozinguez), and [Rob Moran](https://github.com/thegecko). | ||
These definitions were written by [Uri Shaked](https://github.com/urish), [Xavier Lozinguez](http://github.com/xlozinguez), [Rob Moran](https://github.com/thegecko), and [David Bjerremose](https://github.com/DaBs). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10757
150