mirror of
https://github.com/electron/electron.git
synced 2026-01-10 07:58:08 -05:00
docs: update select-serial-port example (#26992)
This commit is contained in:
@@ -215,15 +215,15 @@ app.whenReady().then(() => {
|
||||
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()
|
||||
const selectedPort = portList.find((device) => {
|
||||
return device.vendorId === 0x2341 && device.productId === 0x0043
|
||||
return device.vendorId === '9025' && device.productId === '67'
|
||||
})
|
||||
if (!selectedPort) {
|
||||
callback('')
|
||||
} else {
|
||||
callback(result1.portId)
|
||||
callback(selectedPort.portId)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user