зеркало из https://github.com/electron/electron.git
Merge pull request #13187 from LostPlayer99/patch-1
docs: update bluetooth example
This commit is contained in:
Коммит
78e199b5d7
|
@ -568,11 +568,14 @@ first available device will be selected. `callback` should be called with
|
||||||
cancel the request.
|
cancel the request.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const {app, webContents} = require('electron')
|
const {app, BrowserWindow} = require('electron')
|
||||||
app.commandLine.appendSwitch('enable-web-bluetooth')
|
|
||||||
|
let win = null
|
||||||
|
app.commandLine.appendSwitch('enable-experimental-web-platform-features')
|
||||||
|
|
||||||
app.on('ready', () => {
|
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()
|
event.preventDefault()
|
||||||
let result = deviceList.find((device) => {
|
let result = deviceList.find((device) => {
|
||||||
return device.deviceName === 'test'
|
return device.deviceName === 'test'
|
||||||
|
|
Загрузка…
Ссылка в новой задаче