useBluetooth ​
browser
test coverage
Last changed: 28 days ago
TIP
This hook uses navigator.bluetooth browser api to provide enhanced functionality. Make sure to check for compatibility with different browsers when using this api
Hook for getting information about bluetooth
typescript
import { useBluetooth } from '@siberiacancode/reactuse';
Usage ​
typescript
const { supported, connected, device, requestDevice, server } = useBluetooth(options);
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
options.acceptAllDevices? | boolean | false | The options to request all Bluetooth devices |
options.filters? | Array<BluetoothLEScanFilter> | - | Array of filters to apply when scanning Bluetooth devices |
options.optionalServices? | Array<BluetoothServiceUUID> | - | Array of optional services that the application can use |