removeEventListener
The removeEventListener method removes an event listener for a specific event.
Signature
async removeEventListener(
evt: MutexoEventName,
callback: ( data: any ) => void
): this
Parameters
evt:MutexoEventName- The name of the event to stop listening for.callback: (data: any) => void - The function to remove from the event listeners.
Returns
this: The current instance ofMutexoClient.
Description
The removeEventListener method removes an event listener for a specific event. The listener will no longer be called when the specified event is emitted.
This method is also available as removeListener and off.
Examples
Remove an event listener for the "input" event
const client = new MutexoClient(webSocket);
const utxoSpentHandler = _evt => {
console.log("someone spent something")
};
client.addEventListener("input", utxoSpentHandler);
// Later, remove the event listener
client.removeEventListener("input", utxoSpentHandler);