[serialport] added readonly properties

https://node-serialport.github.io/node-serialport/SerialPort.html
This commit is contained in:
Wolf Walter
2018-06-10 09:45:16 +02:00
parent 42e514d82c
commit a81f093aaa
2 changed files with 14 additions and 0 deletions
+5
View File
@@ -12,6 +12,11 @@ declare class SerialPort extends Stream.Duplex {
constructor(path: string, callback?: SerialPort.ErrorCallback);
constructor(path: string, options?: SerialPort.OpenOptions, callback?: SerialPort.ErrorCallback);
readonly baudRate: number;
readonly binding: SerialPort.BaseBinding;
readonly isOpen: boolean;
readonly path: string;
open(callback?: SerialPort.ErrorCallback): void;
update(options: SerialPort.UpdateOptions, callback?: SerialPort.ErrorCallback): void;
+9
View File
@@ -117,3 +117,12 @@ function test_parsers() {
port.pipe(ReadyParser);
port.pipe(RegexParser);
}
function test_properties() {
const port = new SerialPort('');
const baudRate: number = port.baudRate;
const binding: SerialPort.BaseBinding = port.binding;
const isOpen: boolean = port.isOpen;
const path: string = port.path;
}