From 5b97a8f59d36957a631b1290276e5a6571b913ad Mon Sep 17 00:00:00 2001 From: Kyle McCarthy Date: Mon, 4 Mar 2019 09:29:17 -0600 Subject: [PATCH 1/2] update onData handle, allow for user data to be attached to response --- docs/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/index.d.ts b/docs/index.d.ts index acfb30a..53a1026 100644 --- a/docs/index.d.ts +++ b/docs/index.d.ts @@ -67,10 +67,13 @@ interface HttpResponse { onAborted(handler: (res: HttpResponse) => void) : HttpResponse; /** Handler for reading data from POST and such requests. You MUST copy the data of chunk if isLast is not true. We Neuter ArrayBuffers on return, making it zero length.*/ - onData(handler: (res: HttpResponse, chunk: ArrayBuffer, isLast: boolean) => void) : HttpResponse; + onData(handler: (chunk: ArrayBuffer, isLast: boolean) => void) : HttpResponse; /** Returns the remote IP address */ getRemoteAddress() : ArrayBuffer; + + /** Arbitrary user data may be attached to this object */ + [key: string]: any; } /** An HttpRequest is stack allocated and only accessible during the callback invocation. */ From d66c4a6735a73237bf81b30f25c0905f8993d056 Mon Sep 17 00:00:00 2001 From: Kyle McCarthy Date: Mon, 4 Mar 2019 16:41:17 -0600 Subject: [PATCH 2/2] allow for user data to be attached to the websocket --- docs/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/index.d.ts b/docs/index.d.ts index 53a1026..9160cd0 100644 --- a/docs/index.d.ts +++ b/docs/index.d.ts @@ -33,6 +33,9 @@ interface WebSocket { /** Returns the remote IP address */ getRemoteAddress() : ArrayBuffer; + + /** Arbitrary user data may be attached to this object */ + [key: string]: any; } /** An HttpResponse is valid until either onAborted callback or any of the .end/.tryEnd calls succeed. You may attach user data to this object. */