mirror of
https://github.com/meshcore-dev/meshcore.js.git
synced 2026-04-20 22:13:49 +00:00
detect serial disconnect
This commit is contained in:
parent
995e740347
commit
af6403bf6a
2 changed files with 12 additions and 0 deletions
|
|
@ -15,6 +15,11 @@ class SerialConnection extends Connection {
|
|||
this.readBuffer = [];
|
||||
this.readLoop();
|
||||
|
||||
// listen for disconnect
|
||||
this.serialPort.addEventListener("disconnect", () => {
|
||||
this.emit("disconnected");
|
||||
});
|
||||
|
||||
// fire connected callback after constructor has returned
|
||||
setTimeout(() => {
|
||||
this.onConnected();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue