mirror of
https://github.com/Eugeny/tabby
synced 2024-11-15 01:17:14 +00:00
fixed serial modal crash (#2278)
This commit is contained in:
parent
09d55979ce
commit
045cc0d243
1 changed files with 17 additions and 15 deletions
|
@ -64,23 +64,25 @@ export class SerialService {
|
||||||
|
|
||||||
async showConnectionSelector (): Promise<void> {
|
async showConnectionSelector (): Promise<void> {
|
||||||
const options: SelectorOption<void>[] = []
|
const options: SelectorOption<void>[] = []
|
||||||
const lastConnection = JSON.parse(window.localStorage.lastSerialConnection)
|
|
||||||
const foundPorts = await this.listPorts()
|
const foundPorts = await this.listPorts()
|
||||||
|
|
||||||
if (lastConnection) {
|
try {
|
||||||
options.push({
|
const lastConnection = JSON.parse(window.localStorage.lastSerialConnection)
|
||||||
name: lastConnection.name,
|
if (lastConnection) {
|
||||||
icon: 'history',
|
options.push({
|
||||||
callback: () => this.connect(lastConnection),
|
name: lastConnection.name,
|
||||||
})
|
icon: 'history',
|
||||||
options.push({
|
callback: () => this.connect(lastConnection),
|
||||||
name: 'Clear last connection',
|
})
|
||||||
icon: 'eraser',
|
options.push({
|
||||||
callback: () => {
|
name: 'Clear last connection',
|
||||||
window.localStorage.lastSerialConnection = null
|
icon: 'eraser',
|
||||||
},
|
callback: () => {
|
||||||
})
|
window.localStorage.lastSerialConnection = null
|
||||||
}
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch { }
|
||||||
|
|
||||||
for (const port of foundPorts) {
|
for (const port of foundPorts) {
|
||||||
options.push({
|
options.push({
|
||||||
|
|
Loading…
Reference in a new issue