File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -8,17 +8,7 @@ export class DeviceService {
88 private deviceType : string = '' ;
99 private decoder : TextDecoder = new TextDecoder ( ) ;
1010
11- constructor ( ) {
12- // Contiuously check the port status every 2 seconds to update the connection status/card
13- setInterval ( ( ) => {
14- console . log ( '[DeviceService]: Checking port status...' ) ;
15- if ( this . port && ! this . port . readable && ! this . port . writable ) {
16- console . log ( '[DeviceService]: Port is not readable or writable, disconnecting...' ) ;
17- this . disconnect ( ) ;
18- }
19- } , 2000 ) ;
20-
21- }
11+ constructor ( ) { }
2212
2313 // Check if port is available (return true if available)
2414 // Don't run if we are already connected from within this tab
@@ -107,6 +97,15 @@ export class DeviceService {
10797 detail : { msg : "Connected" }
10898 } ) ;
10999 document . dispatchEvent ( event )
100+
101+ // Contiuously check the port status every 2 seconds to update the connection status/card
102+ setInterval ( ( ) => {
103+ console . log ( '[DeviceService]: Checking port status...' ) ;
104+ if ( this . port && ! this . port . readable && ! this . port . writable ) {
105+ console . log ( '[DeviceService]: Port is not readable or writable, disconnecting...' ) ;
106+ this . disconnect ( ) ;
107+ }
108+ } , 2000 ) ;
110109 }
111110
112111 async disconnect ( ) : Promise < void > {
You can’t perform that action at this time.
0 commit comments