Skip to content

Commit c99aef8

Browse files
committed
frontend: small bluetooth api cleanup
- remove unnecessary exports - name TBluetoothState type for better clarity - reformat nested TPeripheral union type
1 parent 3c2a118 commit c99aef8

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

frontends/web/src/api/bluetooth.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,21 @@ export type TPeripheral = {
2121
identifier: string;
2222
name: string;
2323
} & (
24-
| {
25-
connectionState: 'discovered' | 'connecting' | 'connected';
26-
}
27-
| {
28-
connectionState: 'error';
29-
connectionError: string;
30-
}
24+
{
25+
connectionState: 'discovered' | 'connecting' | 'connected';
26+
} | {
27+
connectionState: 'error';
28+
connectionError: string;
29+
}
3130
);
3231

33-
export type TState = {
32+
type TBluetoothState = {
3433
bluetoothAvailable: boolean;
3534
scanning: boolean;
3635
peripherals: TPeripheral[];
3736
};
3837

39-
export const getState = (): Promise<TState> => {
38+
export const getState = (): Promise<TBluetoothState> => {
4039
return apiGet('bluetooth/state');
4140
};
4241

@@ -45,7 +44,7 @@ export const connect = (identifier: string): Promise<void> => {
4544
};
4645

4746
export const syncState = (
48-
cb: (state: TState) => void
47+
cb: (state: TBluetoothState) => void
4948
): TUnsubscribe => {
5049
return subscribeEndpoint('bluetooth/state', cb);
5150
};

0 commit comments

Comments
 (0)