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

Line 287: Line 287:
; Description
; Description
: The method turns off the local bluetooth adapter.
: The method turns off the local bluetooth adapter.
: This is an asynchronous method and its result is returned via a Promise. Once the method is called, [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#state|adapter.state]] becomes <tt>disabling</tt> and a corresponding [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#onattributechanged|onattributechanged]] would be triggered. If the disable operation succeeds, several [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#onattributechanged|onattributechanged]] would be triggered before the Promise is resolved to the indicate all properties (except [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#state|adapter.state]], [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#pairingReqs|adapter.pairingReqs]], and event handlers) become default value, and the last one must indicate [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#state|adapter.state]] becomes <tt>disabled</tt>. In other words, all adapter's properties except [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#pairingReqs|adapter.pairingReqs]] and event handlers are reset to default value once [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#state|adapter.state]] becomes <tt>disabled</tt>.
: This is an asynchronous method and its result is returned via a Promise. Once the method is called, property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#state|state]] becomes <tt>disabling</tt> and a corresponding [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#onattributechanged|onattributechanged]] would be triggered. If the disable operation succeeds, several [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#onattributechanged|onattributechanged]] would be triggered before the Promise is resolved to the indicate all properties (except [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#state|state]], [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#pairingReqs|pairingReqs]], and event handlers) become default value, and the last one must indicate property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#state|state]] becomes <tt>disabled</tt>. In other words, all adapter's properties except [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#pairingReqs|pairingReqs]] and event handlers are reset to default value once property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#state|state]] becomes <tt>disabled</tt>.


; Return
; Return
Confirmed users
891

edits