Confirmed users
891
edits
Line 53: | Line 53: | ||
; Parameter | ; Parameter | ||
: ''aAttributeEvent'' | : ''aAttributeEvent'' | ||
:: The event is a [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAttributeEvent#Interface|BluetoothAttributeEvent]] with property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAttributeEvent# | :: The event is a [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAttributeEvent#Interface|BluetoothAttributeEvent]] with property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAttributeEvent#attrs|attrs]] that contains a [[B2G/Bluetooth/WebBluetooth-v2/BluetoothManager#BluetoothManagerAttribute|BluetoothManagerAttribute]]. | ||
; Sample | ; Sample | ||
var manager = navigator.mozBluetooth; | var manager = navigator.mozBluetooth; | ||
manager.onattributechanged = function onManagerAttributeChanged(evt) { | manager.onattributechanged = function onManagerAttributeChanged(evt) { | ||
var attr | for (var attr in evt.attrs) { | ||
switch (attr) { | |||
case BluetoothManagerAttribute.defaultAdapter: | |||
console.log("defaultAdapter changed. address:", manager.defaultAdapter.address); | |||
break; | |||
default: | |||
break; | |||
} | |||
} | } | ||
} | } |