docs: update select-serial-port example (#26992)
This commit is contained in:
parent
998f17ee59
commit
420eaaa294
1 changed files with 3 additions and 3 deletions
|
@ -215,15 +215,15 @@ app.whenReady().then(() => {
|
||||||
enableBlinkFeatures: 'Serial'
|
enableBlinkFeatures: 'Serial'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
win.webContents.session.on('select-serial-port', (event, portList, callback) => {
|
win.webContents.session.on('select-serial-port', (event, portList, webContents, callback) => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
const selectedPort = portList.find((device) => {
|
const selectedPort = portList.find((device) => {
|
||||||
return device.vendorId === 0x2341 && device.productId === 0x0043
|
return device.vendorId === '9025' && device.productId === '67'
|
||||||
})
|
})
|
||||||
if (!selectedPort) {
|
if (!selectedPort) {
|
||||||
callback('')
|
callback('')
|
||||||
} else {
|
} else {
|
||||||
callback(result1.portId)
|
callback(selectedPort.portId)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue