mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-24 22:58:46 +01:00
chore: code format
This commit is contained in:
parent
41608b4b30
commit
ae68c4dc6e
1 changed files with 25 additions and 14 deletions
|
@ -519,25 +519,36 @@ new Vue({
|
|||
navigator.serial.addEventListener('disconnect', event => {
|
||||
console.log('### navigator.serial event: disconnected!', event)
|
||||
})
|
||||
// const ports = await navigator.serial.getPorts();
|
||||
const port = await navigator.serial.requestPort()
|
||||
console.log('### port', port)
|
||||
try {
|
||||
// const ports = await navigator.serial.getPorts();
|
||||
const port = await navigator.serial.requestPort()
|
||||
console.log('### port', port)
|
||||
|
||||
// Wait for the serial port to open.
|
||||
await port.open({baudRate: 9600})
|
||||
// Wait for the serial port to open.
|
||||
await port.open({baudRate: 9600})
|
||||
|
||||
const writer = port.writable.getWriter()
|
||||
const writer = port.writable.getWriter()
|
||||
|
||||
const psbtByteArray = Uint8Array.from(atob(this.payment.psbtBase64), c =>
|
||||
c.charCodeAt(0)
|
||||
)
|
||||
await writer.write(psbtByteArray)
|
||||
const psbtByteArray = Uint8Array.from(
|
||||
atob(this.payment.psbtBase64),
|
||||
c => c.charCodeAt(0)
|
||||
)
|
||||
await writer.write(psbtByteArray)
|
||||
|
||||
// Allow the serial port to be closed later.
|
||||
writer.releaseLock()
|
||||
// Allow the serial port to be closed later.
|
||||
writer.releaseLock()
|
||||
|
||||
await port.close()
|
||||
console.log('### sharePsbtOnSerialPort done')
|
||||
await port.close()
|
||||
console.log('### sharePsbtOnSerialPort done')
|
||||
} catch (error) {
|
||||
console.log('### error', error)
|
||||
this.$q.notify({
|
||||
type: 'warning',
|
||||
message: 'Serial port communication failed!',
|
||||
caption: `${error}`,
|
||||
timeout: 10000
|
||||
})
|
||||
}
|
||||
},
|
||||
sharePsbtWithAnimatedQRCode: async function () {
|
||||
console.log('### sharePsbtWithAnimatedQRCode')
|
||||
|
|
Loading…
Add table
Reference in a new issue