samchon / tgrid

TypeScript RPC (Remote Procedure Call) for WebSocket and Worker protocols
https://tgrid.com/
MIT License
141 stars 19 forks source link

Connector.connect() with detailed options through the object type #49

Closed samchon closed 3 years ago

samchon commented 3 years ago

To extendability, it would better to configure the object typed options parameter.

export class WebConnector
{
    // NOT EXTENTABLE
    public async connection(url: string, timeout?: number): Promise<void>;

    // EXTENDABLE
    public async connect(url: string, options: WebConnector.IConnectOptions): Promise<void>;
}
export namespace WebConnector
{
    export interface IConnectOptions
    {
        timeout: number
    }
}