mirror of
https://github.com/servo/servo
synced 2026-05-02 20:32:02 +02:00
Update WebBluetooth to use Promises
This commit is contained in:
committed by
Attila Dusnoki
parent
fb52bb7c8d
commit
e05a839d25
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user