chore: code format

This commit is contained in:
Vlad Stan 2022-07-13 12:45:38 +03:00
parent 41608b4b30
commit ae68c4dc6e

View file

@ -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')