This commit is contained in:
deepak1556 2016-06-01 11:39:14 +05:30
parent de4bff003f
commit 7434838463

View file

@ -385,9 +385,29 @@ Returns:
* `deviceId` String * `deviceId` String
Emitted when bluetooth device needs to be selected on call to Emitted when bluetooth device needs to be selected on call to
`navigator.bluetooth.requestDevice`. If `event.preventDefault` is not called, `navigator.bluetooth.requestDevice`. To use `navigator.bluetooth` api
first available device will be selected. `callback` should be called with `deviceId` `webBluetooth` should be enabled. If `event.preventDefault` is not called,
to be selected. first available device will be selected. `callback` should be called with
`deviceId` to be selected, passing empty string to `callback` will
cancel the request.
```javacript
app.commandLine.appendSwitch('enable-web-bluetooth')
app.on('ready', () => {
webContents.on('select-bluetooth-device', (event, deviceList, callback) => {
event.preventDefault()
let result = deviceList.find((device) => {
return device.deviceName === 'test'
})
if (!result) {
callback('')
} else {
callback(result.deviceId)
}
})
})
```
## Instance Methods ## Instance Methods