Skip to content

Commit

Permalink
types: add on('connect') (mqttjs#963)
Browse files Browse the repository at this point in the history
  • Loading branch information
taoqf authored and Cédric von Allmen committed Nov 27, 2020
1 parent 7193d0c commit 0342c67
Showing 1 changed file with 4 additions and 3 deletions.
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

0 comments on commit 0342c67

Please sign in to comment.