File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -6,10 +6,6 @@ import { microbitStore } from '../microbit-store';
6
6
tag : 'microbit-connect'
7
7
} )
8
8
export class MicrobitConnect {
9
- constructor ( ) {
10
- microbitStore . addListener ( this ) ;
11
- }
12
-
13
9
@Element ( ) el ;
14
10
@Prop ( { mutable : true } ) device : BluetoothDevice = null ;
15
11
@@ -38,12 +34,14 @@ export class MicrobitConnect {
38
34
if ( this . device . gatt . connected ) {
39
35
await this . device . gatt . disconnect ( ) ;
40
36
}
37
+ this . device = null ;
41
38
microbitStore . empty ( ) ;
42
39
return ;
43
40
}
44
41
45
42
const device = await requestMicrobit ( window . navigator . bluetooth ) ;
46
43
if ( device ) {
44
+ this . device = device ;
47
45
microbitStore . update ( "device" , device ) ;
48
46
const services = await getServices ( device ) ;
49
47
microbitStore . update ( "services" , services ) ;
You can’t perform that action at this time.
0 commit comments