add ctrl+c closeSerial
This commit is contained in:
parent
efc277d8a5
commit
57fc3dff2d
5
app.js
5
app.js
@ -31,6 +31,7 @@ bleno.on('advertisingStart', function (error) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
localEvent.on('print', async (str) => {
|
localEvent.on('print', async (str) => {
|
||||||
|
console.log(`get printer string >>> \n${str}`)
|
||||||
let status = false
|
let status = false
|
||||||
if (printer.isOpen) {
|
if (printer.isOpen) {
|
||||||
try {
|
try {
|
||||||
@ -41,4 +42,8 @@ localEvent.on('print', async (str) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
localEvent.emit('printResult', status)
|
localEvent.emit('printResult', status)
|
||||||
|
})
|
||||||
|
|
||||||
|
process.on('SIGINT', () => {
|
||||||
|
printer.close()
|
||||||
})
|
})
|
Loading…
Reference in New Issue
Block a user