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

feat: Add eventEmitter2Options #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {EventEmitter2, Listener, OnOptions} from "eventemitter2";
import {EventEmitter2, Listener, OnOptions, ConstructorOptions} from "eventemitter2";

export type QoS = 0 | 1 | 2;

Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down