Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: add on('connect') #963

Merged
merged 1 commit into from May 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions types/lib/client.d.ts
Expand Up @@ -66,6 +66,7 @@ export interface ISubscriptionMap {
}
}

export declare type OnConnectCallback = (packet: Packet) => void
export declare type ClientSubscribeCallback = (err: Error, granted: ISubscriptionGrant[]) => void
export declare type OnMessageCallback = (topic: string, payload: Buffer, packet: Packet) => void
export declare type OnPacketCallback = (packet: Packet) => void
Expand Down Expand Up @@ -97,15 +98,15 @@ export declare class MqttClient extends events.EventEmitter {

constructor (streamBuilder: (client: MqttClient) => IStream, options: IClientOptions)

public on (event: 'connect', cb: OnConnectCallback): this
public on (event: 'message', cb: OnMessageCallback): this
public on (event: 'packetsend' | 'packetreceive', cb: OnPacketCallback): this
public on (event: 'error', cb: OnErrorCallback): this
public on (event: string, cb: Function): this

public once (event: 'connect', cb: OnConnectCallback): this
public once (event: 'message', cb: OnMessageCallback): this
public once (event:
'packetsend'
| 'packetreceive', cb: OnPacketCallback): this
public once (event: 'packetsend' | 'packetreceive', cb: OnPacketCallback): this
public once (event: 'error', cb: OnErrorCallback): this
public once (event: string, cb: Function): this

Expand Down