mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-25 07:07:48 +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 => {
|
navigator.serial.addEventListener('disconnect', event => {
|
||||||
console.log('### navigator.serial event: disconnected!', event)
|
console.log('### navigator.serial event: disconnected!', event)
|
||||||
})
|
})
|
||||||
// const ports = await navigator.serial.getPorts();
|
try {
|
||||||
const port = await navigator.serial.requestPort()
|
// const ports = await navigator.serial.getPorts();
|
||||||
console.log('### port', port)
|
const port = await navigator.serial.requestPort()
|
||||||
|
console.log('### port', port)
|
||||||
|
|
||||||
// Wait for the serial port to open.
|
// Wait for the serial port to open.
|
||||||
await port.open({baudRate: 9600})
|
await port.open({baudRate: 9600})
|
||||||
|
|
||||||
const writer = port.writable.getWriter()
|
const writer = port.writable.getWriter()
|
||||||
|
|
||||||
const psbtByteArray = Uint8Array.from(atob(this.payment.psbtBase64), c =>
|
const psbtByteArray = Uint8Array.from(
|
||||||
c.charCodeAt(0)
|
atob(this.payment.psbtBase64),
|
||||||
)
|
c => c.charCodeAt(0)
|
||||||
await writer.write(psbtByteArray)
|
)
|
||||||
|
await writer.write(psbtByteArray)
|
||||||
|
|
||||||
// Allow the serial port to be closed later.
|
// Allow the serial port to be closed later.
|
||||||
writer.releaseLock()
|
writer.releaseLock()
|
||||||
|
|
||||||
await port.close()
|
await port.close()
|
||||||
console.log('### sharePsbtOnSerialPort done')
|
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 () {
|
sharePsbtWithAnimatedQRCode: async function () {
|
||||||
console.log('### sharePsbtWithAnimatedQRCode')
|
console.log('### sharePsbtWithAnimatedQRCode')
|
||||||
|
|
Loading…
Add table
Reference in a new issue