diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index 34132af74d..30934409ee 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -568,11 +568,14 @@ first available device will be selected. `callback` should be called with cancel the request. ```javascript -const {app, webContents} = require('electron') -app.commandLine.appendSwitch('enable-web-bluetooth') +const {app, BrowserWindow} = require('electron') + +let win = null +app.commandLine.appendSwitch('enable-experimental-web-platform-features') 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'