-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathnode.d.ts
More file actions
25 lines (24 loc) · 1.44 KB
/
node.d.ts
File metadata and controls
25 lines (24 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
declare class Buffer extends Uint8Array {
/** This method allocates a new Buffer of indicated size. All of the data is zeroed. */
static alloc(size: i32): Buffer;
/** This method allocates a new Buffer of indicated size. This is unsafe because the data is not zeroed. */
static allocUnsafe(size: i32): Buffer;
/** This method asserts a value is a Buffer object via `value instanceof Buffer`. */
static isBuffer<T>(value: T): bool;
/** Reads an unsigned integer at the designated offset. */
readUInt8(offset?: i32): u8;
/** Writes an inputted u8 value to the buffer, at the desired offset. */
writeUInt8(value:u8, offset?:i32): i32;
/** Writes an inputted value to the buffer, at the desired offset. */
writeInt8(value:i8, offset?:i32): i32;
/** Reads a signed integer at the designated offset. */
readInt8(offset?: i32): i8;
}
export abstract class EventEmitter {
/** Call this function globally to setup a callback on your EventEmitter type `T`, with callback type `U`, and eventName `event`. */
public static registerEventCallback<T, U>(event: string): void;
/** Register a callback event of type `T` with eventName `event`. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times. */
public on<T>(event: string, callback: T): this;
/** Emit a callback event with the given parameters (up to 10.) */
public emit<T extends any[]>(...args: T): this;
}