Merge pull request #10 from mtlynch/race-condition

Fix race condition in WebBleConnection
This commit is contained in:
Liam Cottle 2026-01-02 23:36:19 +13:00 committed by GitHub
commit 9671e46955
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,7 +9,6 @@ class WebBleConnection extends Connection {
this.gattServer = null;
this.rxCharacteristic = null;
this.txCharacteristic = null;
this.init();
}
static async open() {
@ -36,8 +35,11 @@ class WebBleConnection extends Connection {
return null;
}
return new WebBleConnection(device);
// create connection and initialize it
const connection = new WebBleConnection(device);
await connection.init();
return connection;
}
async init() {