Skip to content

Commit a46e5cf

Browse files
authored
Made requestDevice async
Made requestDevice's connection section async and awaited connectDeviceAndCacheCharacteristics so errors thrown by requestDevice can now be caught
1 parent 8f3bdf9 commit a46e5cf

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

godice.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,14 @@ class GoDice {
270270
filters: [{ namePrefix: 'GoDice_' }],
271271
optionalServices: ['6e400001-b5a3-f393-e0a9-e50e24dcca9e']
272272
})
273-
.then(device => {
273+
.then(async device => {
274274
this.GlobalDeviceId = device.id.toString();
275275
this.bluetoothDevice = device;
276276
var _self = this
277277
this.bluetoothDevice.addEventListener('gattserverdisconnected', function() {
278278
_self.onDiceDisconnected(_self.GlobalDeviceId, _self)
279279
})
280-
this.connectDeviceAndCacheCharacteristics();
280+
await this.connectDeviceAndCacheCharacteristics();
281281
});
282282
}
283283

0 commit comments

Comments
 (0)