B2G/Bluetooth/WebBluetooth-v2/BluetoothDevice: Difference between revisions

Jump to navigation Jump to search
Line 128: Line 128:
; Sample
; Sample
  device.onattributechanged = function onDeviceAttributeChanged(evt) {
  device.onattributechanged = function onDeviceAttributeChanged(evt) {
   for (var attr in evt.attrs) {
   for (var i in evt.attrs) {
     switch (attr) {
     switch (evt.attrs[i]) {
       case BluetoothDeviceAttribute.name:
       case 'name':
         console.log("device name changed to", device.name);
         console.log("device name changed to", device.name);
         break;
         break;
       case BluetoothDeviceAttribute.paired:
       case 'paired':
         console.log("device paired changed to", device.paired);
         console.log("device paired changed to", device.paired);
         break;
         break;
Confirmed users
891

edits

Navigation menu