reactuals
Version:
A useful package providing a collection of 50+ React hooks and utilities to simplify React development.
32 lines (31 loc) • 739 B
TypeScript
type BluetoothDevice = {
id: string;
name?: string;
gatt?: {
connected: boolean;
disconnect(): void;
};
};
type BluetoothDeviceType = BluetoothDevice & {
gatt?: {
connected: boolean;
disconnect(): void;
};
};
interface RequestDeviceOptions {
filters?: Array<{
services?: string[];
name?: string;
namePrefix?: string;
}>;
optionalServices?: string[];
acceptAllDevices?: boolean;
}
export declare function useWebBluetooth(): {
connect: (options: RequestDeviceOptions) => Promise<BluetoothDeviceType | null>;
disconnect: () => void;
device: BluetoothDeviceType | null;
isSupported: boolean;
error: Error | null;
};
export {};