From 6776ef66c24df8a738c7fb1a1250faa3e2d9a6a1 Mon Sep 17 00:00:00 2001 From: "big.dev" Date: Thu, 23 Feb 2023 16:54:02 +0700 Subject: [PATCH 1/2] feat: Add eventEmitter2Options --- index.d.ts | 1 + index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index b801737..e2494f3 100644 --- a/index.d.ts +++ b/index.d.ts @@ -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)) From 802f0e4e374f88dae3b85b093eba5923819e4230 Mon Sep 17 00:00:00 2001 From: "big.dev" Date: Thu, 23 Feb 2023 17:07:38 +0700 Subject: [PATCH 2/2] fix import --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index e2494f3..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;