From 370d7907769b8ea00d89cb42719efd1a86455a1c Mon Sep 17 00:00:00 2001 From: Mateus Silva Date: Thu, 7 Jun 2018 20:29:20 +0100 Subject: [PATCH 1/2] Doc: Update bluetooth example Update event select-bluetooth-device example documentation. --- docs/api/web-contents.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index 34132af74d..cb2b40eff3 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') +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' From 1b3cd01851bbb24b491ab04bb14078b4444f4a8e Mon Sep 17 00:00:00 2001 From: Mateus Silva Date: Tue, 12 Jun 2018 20:07:37 +0100 Subject: [PATCH 2/2] Doc: Delete unnecessary require and update flag name --- docs/api/web-contents.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index cb2b40eff3..30934409ee 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -568,10 +568,10 @@ first available device will be selected. `callback` should be called with cancel the request. ```javascript -const {app, webContents, BrowserWindow} = require('electron') +const {app, BrowserWindow} = require('electron') let win = null -app.commandLine.appendSwitch('enable-web-bluetooth') +app.commandLine.appendSwitch('enable-experimental-web-platform-features') app.on('ready', () => { win = new BrowserWindow({width: 800, height: 600})