mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Update WebBluetooth to use Promises
This commit is contained in:
parent
fb52bb7c8d
commit
e05a839d25
32 changed files with 684 additions and 458 deletions
|
@ -52,19 +52,20 @@
|
|||
|
||||
function onButtonClick(testNumber) {
|
||||
clear();
|
||||
try {
|
||||
log('Requesting Bluetooth Device...');
|
||||
var device = window.navigator.bluetooth.requestDevice(testCases[testNumber]);
|
||||
|
||||
log('Requesting Bluetooth Device...');
|
||||
window.navigator.bluetooth.requestDevice(testCases[testNumber])
|
||||
.then(device => {
|
||||
log('Found a device!');
|
||||
log('> Name: ' + device.name);
|
||||
log('> Id: ' + device.id);
|
||||
log('> Appearance: ' + device.adData.appearance);
|
||||
log('> Tx Power: ' + device.adData.txPower + ' dBm');
|
||||
log('> RSSI: ' + device.adData.rssi + ' dBm');
|
||||
} catch(err) {
|
||||
})
|
||||
.catch(err => {
|
||||
log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
populate(testCases);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue