mirror of
https://github.com/moritzruth/node-enttec-open-dmx-usb.git
synced 2025-04-21 07:41:22 +02:00
Merge pull request #79 from Granjow/feature/fix-constructor-serial-error
This commit is contained in:
commit
a565e9e5b7
2 changed files with 8 additions and 1 deletions
|
@ -41,4 +41,4 @@ import { EnttecOpenDMXUSBDevice as DMXDevice } from "enttec-open-dmx-usb";
|
||||||
## Events
|
## Events
|
||||||
`ready` - `startSending` can be called.
|
`ready` - `startSending` can be called.
|
||||||
|
|
||||||
`error` - An error occurred.
|
`error` - An error occurred. The error can also originate from SerialPort.
|
||||||
|
|
|
@ -35,6 +35,13 @@ export class EnttecOpenDMXUSBDevice extends EventEmitter<Events> {
|
||||||
this.emit("ready")
|
this.emit("ready")
|
||||||
if (startSending) this.startSending(0)
|
if (startSending) this.startSending(0)
|
||||||
})
|
})
|
||||||
|
// Forward SerialPort errors.
|
||||||
|
// If nothing is attaching to the SerialPort error event, the Node process will be terminated
|
||||||
|
// in case of an error (e.g. wrong device passed) which would not permit error handling in
|
||||||
|
// projects using this package.
|
||||||
|
this.port.on("error", (error: Error) => {
|
||||||
|
this.emit("error", error)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue