Add type definitions to the methods of UhkBuffer.
This commit is contained in:
@@ -2,42 +2,42 @@ class UhkBuffer {
|
|||||||
buffer: Buffer;
|
buffer: Buffer;
|
||||||
offset: number;
|
offset: number;
|
||||||
|
|
||||||
constructor(buffer) {
|
constructor(buffer:Buffer) {
|
||||||
this.offset = 0;
|
this.offset = 0;
|
||||||
this.buffer = buffer;
|
this.buffer = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeInt8(value) {
|
writeInt8(value:number):void {
|
||||||
this.buffer.writeInt8(value, this.offset);
|
this.buffer.writeInt8(value, this.offset);
|
||||||
this.offset += 1;
|
this.offset += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeUint8(value) {
|
writeUint8(value:number):void {
|
||||||
this.buffer.writeUInt8(value, this.offset);
|
this.buffer.writeUInt8(value, this.offset);
|
||||||
this.offset += 1;
|
this.offset += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeInt16(value) {
|
writeInt16(value:number):void {
|
||||||
this.buffer.writeInt16LE(value, this.offset);
|
this.buffer.writeInt16LE(value, this.offset);
|
||||||
this.offset += 2;
|
this.offset += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeUint16(value) {
|
writeUint16(value:number):void {
|
||||||
this.buffer.writeUInt16LE(value, this.offset);
|
this.buffer.writeUInt16LE(value, this.offset);
|
||||||
this.offset += 2;
|
this.offset += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeInt32(value) {
|
writeInt32(value:number):void {
|
||||||
this.buffer.writeInt32LE(value, this.offset);
|
this.buffer.writeInt32LE(value, this.offset);
|
||||||
this.offset += 4;
|
this.offset += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeUint32(value) {
|
writeUint32(value:number):void {
|
||||||
this.buffer.writeUInt32LE(value, this.offset);
|
this.buffer.writeUInt32LE(value, this.offset);
|
||||||
this.offset += 4;
|
this.offset += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeString(string) {
|
writeString(string:string):void {
|
||||||
this.buffer.write(string, this.offset, string.length, 'ascii');
|
this.buffer.write(string, this.offset, string.length, 'ascii');
|
||||||
this.offset += string.length;
|
this.offset += string.length;
|
||||||
this.writeUint8(0);
|
this.writeUint8(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user