Merge pull request #83 from kyle-mccarthy/types

type definitions -- update onData handle, allow for user data to be attached to response
This commit is contained in:
Alex Hultman 2019-03-04 23:45:39 +01:00 committed by GitHub
commit ba8deb5272
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

8
docs/index.d.ts vendored
View File

@ -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. */
@ -67,10 +70,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. */