Confirmed users
891
edits
Line 23: | Line 23: | ||
; Parameter | ; Parameter | ||
: ''aAdapterEvent'' | : ''aAdapterEvent'' | ||
:: The event is a [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothAddressEvent BluetoothAdapterEvent] with property [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapterEvent#adapter adapter] as the added bluetooth adapter and isDefault indicating whether the added adapter is default adapter. | :: The event is a [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothAddressEvent BluetoothAdapterEvent] with property [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapterEvent#adapter adapter] as the added bluetooth adapter and [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapterEvent#isDefault isDefault] indicating whether the added adapter is default adapter. | ||
; Sample | ; Sample | ||
function bt_onAdapterAdded(evt) { | function bt_onAdapterAdded(evt) { | ||
var adapter = evt.adapter; | var adapter = evt.adapter; | ||
// do your | var isDefaultAdapter = evt.isDefault; | ||
if (isDefaultAdapter) { | |||
// do your things here. | |||
} | |||
} | } | ||