UNPKG

1.1 kBTypeScriptView Raw
1/// <reference types="node" />
2import type { Packet } from 'mqtt-packet';
3import type { Duplex } from 'stream';
4import type MqttClient from './client';
5import type { IClientOptions } from './client';
6export type DoneCallback = (error?: Error) => void;
7export type GenericCallback<T> = (error?: Error, result?: T) => void;
8export type VoidCallback = () => void;
9export type IStream = Duplex & {
10 socket?: any;
11};
12export type StreamBuilder = (client: MqttClient, opts?: IClientOptions) => IStream;
13export type Callback = () => void;
14export type PacketHandler = (client: MqttClient, packet: Packet, done?: DoneCallback) => void;
15export type TimerVariant = 'auto' | 'worker' | 'native';
16export declare class ErrorWithReasonCode extends Error {
17 code: number;
18 constructor(message: string, code: number);
19}
20export type Constructor<T = {}> = new (...args: any[]) => T;
21export declare function applyMixin(target: Constructor, mixin: Constructor, includeConstructor?: boolean): void;
22export declare const nextTick: (callback: Function, ...args: any[]) => void;
23export declare const MQTTJS_VERSION: any;