diff --git a/index.d.ts b/index.d.ts index b801737..a65cbbe 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,4 @@ -import {EventEmitter2, Listener, OnOptions} from "eventemitter2"; +import {EventEmitter2, Listener, OnOptions, ConstructorOptions} from "eventemitter2"; export type QoS = 0 | 1 | 2; @@ -22,6 +22,7 @@ export interface ClientOptions { willQos?: QoS; // only used when will is true willRetainFlag?: boolean; // only used when will is true automaticReconnect?: boolean; // android only + eventEmitter2Options?: ConstructorOptions } export interface Message { diff --git a/index.js b/index.js index 05ba92a..a04cc4f 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,7 @@ const emitter = new NativeEventEmitter(Mqtt); class MqttClient extends EventEmitter2 { constructor(options, clientRef) { - super(); + super(options.eventEmitter2Options); this.options = options; this.clientRef = clientRef; this._emitterSubscription = emitter.addListener('mqtt_events', this._dispatchEvent.bind(this))