Doc: Update bluetooth example

Update event select-bluetooth-device example documentation.
This commit is contained in:
Mateus Silva 2018-06-07 20:29:20 +01:00 committed by GitHub
parent 1b8790aeb2
commit 370d790776
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -568,11 +568,14 @@ first available device will be selected. `callback` should be called with
cancel the request.
```javascript
const {app, webContents} = require('electron')
const {app, webContents, BrowserWindow} = require('electron')
let win = null
app.commandLine.appendSwitch('enable-web-bluetooth')
app.on('ready', () => {
webContents.on('select-bluetooth-device', (event, deviceList, callback) => {
win = new BrowserWindow({width: 800, height: 600})
win.webContents.on('select-bluetooth-device', (event, deviceList, callback) => {
event.preventDefault()
let result = deviceList.find((device) => {
return device.deviceName === 'test'