Listener called multiple times with a single call

Hello,

I am using Ionic Native and Capacitor to create an ios app using a third-party swift framework.

I have multiple listeners active on my application as shown in the code below.

@objc func startScan(_ call: CAPPluginCall) {
let filter = call.getBool(“filter”) ?? true
self.notifyListeners(“didScan”, data: [“scanning”: true])
call.success()
}

Whenever I call a function like startScan, I do receive the didScan Listener but more than once.

<IonButton onClick={() => BandNativePlugin.startScan({filter: true})} >Start Scan

:zap: [log] - [TSX] didScan {“scanning”:true}
:zap: [log] - [TSX] didScan {“scanning”:true}

As I keep on calling different functions with different listeners, it keeps adding the numbers of calls returned for the listener. It seems like the listener is being called more than once but that is not the case (Since I am calling the notifyListener only once on the ios side).

:zap: [log] - [TSX] didScan {“scanning”:true}

:zap: [log] - [TSX] didScan {“scanning”:true}

:zap: [log] - [TSX] didScan {“scanning”:false}

:zap: [log] - [TSX] didScan {“scanning”:false}

:zap: [log] - [TSX] didSend {“function”:“Get Settings”,“params”:“KCTOldBLETaskBase: Failed to convert the model to JSON”}

:zap: [log] - [TSX] didSend {“function”:“Get Settings”,“params”:“KCTOldBLETaskBase: Failed to convert the model to JSON”}

:zap: [log] - [TSX] didSend {“function”:“Get Settings”,“params”:“KCTOldBLETaskBase: Failed to convert the model to JSON”}

:zap: [log] - [TSX] didReceive {“function”:“Get Settings”,“result”:"",“error”:“errType=KCTErrorType,errInfo”}

:zap: [log] - [TSX] didReceive {“function”:“Get Settings”,“result”:"",“error”:“errType=KCTErrorType,errInfo”}

:zap: [log] - [TSX] didReceive {“function”:“Get Settings”,“result”:"",“error”:“errType=KCTErrorType,errInfo”}

Can someone please help me on this issue and explain me why I am getting multiple instances of same listener and why it is increasing?