From f560b2f6bb69473f2ff5c03d7fd28e8325c55ae7 Mon Sep 17 00:00:00 2001 From: Dengju Deng Date: Thu, 8 Apr 2021 17:47:03 +0800 Subject: [PATCH 1/3] Create index.d.ts --- index.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..c15d3ab --- /dev/null +++ b/index.d.ts @@ -0,0 +1,16 @@ +import { Duplex } from "stream"; +import WebSocket from 'ws'; + +declare class WebSocketJSONStream extends Duplex { + private _emittedClose; + private ws; + constructor(ws: WebSocket); + _read(): void; + _write(object: any, encoding: string, callback: (error?: Error | null) => void): void; + _send(json: string, callback: (error?: Error | null) => void): void; + _final(callback: (error?: Error | null) => void): void; + _destroy(error: any, callback: (error: Error | null) => void): void; + _closeWebSocket(code: number, reason?: string, callback?: (error?: Error | null) => void): void; +} + +export default WebSocketJSONStream; From dd681231939db1db4107533a4a0b010acc00b7dd Mon Sep 17 00:00:00 2001 From: Dengju Deng Date: Thu, 6 May 2021 17:31:11 +0800 Subject: [PATCH 2/3] Update index.d.ts --- index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.d.ts b/index.d.ts index c15d3ab..d826b12 100644 --- a/index.d.ts +++ b/index.d.ts @@ -5,12 +5,12 @@ declare class WebSocketJSONStream extends Duplex { private _emittedClose; private ws; constructor(ws: WebSocket); - _read(): void; - _write(object: any, encoding: string, callback: (error?: Error | null) => void): void; - _send(json: string, callback: (error?: Error | null) => void): void; - _final(callback: (error?: Error | null) => void): void; - _destroy(error: any, callback: (error: Error | null) => void): void; - _closeWebSocket(code: number, reason?: string, callback?: (error?: Error | null) => void): void; + private _read(): void; + private _write(object: any, encoding: string, callback: (error?: Error | null) => void): void; + private _send(json: string, callback: (error?: Error | null) => void): void; + private _final(callback: (error?: Error | null) => void): void; + private _destroy(error: any, callback: (error: Error | null) => void): void; + private _closeWebSocket(code: number, reason?: string, callback?: (error?: Error | null) => void): void; } export default WebSocketJSONStream; From 28ef3bd40c01c0f589faf21f82b1b12061a50e7b Mon Sep 17 00:00:00 2001 From: Dengju Deng Date: Thu, 6 May 2021 17:32:59 +0800 Subject: [PATCH 3/3] Update index.d.ts --- index.d.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/index.d.ts b/index.d.ts index d826b12..1d92d2c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -2,15 +2,7 @@ import { Duplex } from "stream"; import WebSocket from 'ws'; declare class WebSocketJSONStream extends Duplex { - private _emittedClose; - private ws; constructor(ws: WebSocket); - private _read(): void; - private _write(object: any, encoding: string, callback: (error?: Error | null) => void): void; - private _send(json: string, callback: (error?: Error | null) => void): void; - private _final(callback: (error?: Error | null) => void): void; - private _destroy(error: any, callback: (error: Error | null) => void): void; - private _closeWebSocket(code: number, reason?: string, callback?: (error?: Error | null) => void): void; } export default WebSocketJSONStream;