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

Update TypeScript declaration files for cbStorePut. #872

Merged
merged 1 commit into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions types/lib/client-options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { MqttClient } from './client'
import { Store } from './store'
import { QoS } from 'mqtt-packet'

export declare type StorePutCallback = () => void

export interface IClientOptions extends ISecureClientOptions {
port?: number // port is made into a number subsequently
host?: string // host does NOT include port
Expand Down Expand Up @@ -141,6 +143,10 @@ export interface IClientPublishOptions {
* whether or not mark a message as duplicate
*/
dup?: boolean
/**
* callback called when message is put into `outgoingStore`
*/
cbStorePut?: StorePutCallback
}
export interface IClientSubscribeOptions {
/**
Expand Down
9 changes: 4 additions & 5 deletions types/lib/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export declare type OnMessageCallback = (topic: string, payload: Buffer, packet:
export declare type OnPacketCallback = (packet: Packet) => void
export declare type OnErrorCallback = (error: Error) => void
export declare type PacketCallback = (error?: Error, packet?: Packet) => any
export declare type StorePutCallback = () => void
export declare type CloseCallback = () => void

export interface IStream extends events.EventEmitter {
Expand Down Expand Up @@ -119,12 +118,12 @@ export declare class MqttClient extends events.EventEmitter {
* @param {Object} [opts] - publish options, includes:
* @param {Number} [opts.qos] - qos level to publish on
* @param {Boolean} [opts.retain] - whether or not to retain the message
* @param {Function}[opts.cbStorePut] - function(){}
* called when message is put into `outgoingStore`
*
* @param {Function} [callback] - function(err){}
* called when publish succeeds or fails
*
* @param {Function} [cbStorePut] - function(){}
* called when message is put into outgoingStore
* @returns {Client} this - for chaining
* @api public
*
Expand All @@ -134,9 +133,9 @@ export declare class MqttClient extends events.EventEmitter {
* @example client.publish('topic', 'message', console.log)
*/
public publish (topic: string, message: string | Buffer,
opts: IClientPublishOptions, callback?: PacketCallback, cbStorePut?: StorePutCallback): this
opts: IClientPublishOptions, callback?: PacketCallback): this
public publish (topic: string, message: string | Buffer,
callback?: PacketCallback, cbStorePut?: StorePutCallback): this
callback?: PacketCallback): this

/**
* subscribe - subscribe to <topic>
Expand Down