Skip to content

Commit ac78307

Browse files
authored
Fix: Virtual callback is handled in serial.js already (#4743)
* Callback is handled in serial.js already * Remove unused openCancelled * Remove unused callback from disconnect and add return values
1 parent 3fbbe0d commit ac78307

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/js/protocols/VirtualSerial.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class VirtualSerial {
99
constructor() {
1010
this.connected = false;
1111
this.connectionId = false;
12-
this.openCanceled = false;
1312
this.bitrate = 0;
1413
this.bytesReceived = 0;
1514
this.bytesSent = 0;
@@ -18,25 +17,22 @@ class VirtualSerial {
1817
this.transmitting = false;
1918
this.outputBuffer = [];
2019
}
21-
connect(port, options, callback) {
22-
if (!this.openCanceled) {
23-
this.connected = true;
24-
this.connectionId = VIRTUAL;
25-
this.bitrate = 115200;
26-
callback();
27-
}
20+
connect(port, options) {
21+
this.connected = true;
22+
this.connectionId = VIRTUAL;
23+
this.bitrate = 115200;
24+
return true;
2825
}
29-
disconnect(callback) {
26+
disconnect() {
3027
this.connected = false;
3128
this.outputBuffer = [];
3229
this.transmitting = false;
3330
if (this.connectionId) {
3431
this.connectionId = false;
3532
this.bitrate = 0;
36-
if (callback) {
37-
callback(true);
38-
}
33+
return true;
3934
}
35+
return false;
4036
}
4137
getConnectedPort() {
4238
return this.connectionId;

0 commit comments

Comments
 (0)