Docs: update index.d.ts (#122)

Some arguments are optional
This commit is contained in:
Zhangyuan Nie 2019-04-17 05:21:02 -04:00 committed by Alex Hultman
parent 4c44d5ec76
commit 533000b490

4
docs/index.d.ts vendored
View File

@ -11,13 +11,13 @@ type RecognizedString = string | ArrayBuffer | Uint8Array | Int8Array | Uint16Ar
/** A WebSocket connection that is valid from open to close event */
interface WebSocket {
/** Sends a message. Make sure to check getBufferedAmount() before sending. Returns true for success, false for built up backpressure that will drain when time is given. */
send(message: RecognizedString, isBinary: boolean, compress: boolean) : boolean;
send(message: RecognizedString, isBinary?: boolean, compress?: boolean) : boolean;
/** Returns the bytes buffered in backpressure. */
getBufferedAmount() : number;
/** Gradefully closes this WebSocket. Immediately calls close handler. */
end(code: number, shortMessage: RecognizedString) : WebSocket;
end(code?: number, shortMessage?: RecognizedString) : WebSocket;
/** Forefully closes this WebSocket. Immediately calls close handler. */
close() : WebSocket;