From 6b0539fc6a94b34219bb57a0705774a23b60ff1c Mon Sep 17 00:00:00 2001 From: Jared Wray Date: Wed, 16 Oct 2024 14:04:34 -0700 Subject: [PATCH] adding in the optional --- src/eventified.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/eventified.ts b/src/eventified.ts index 1cd5c08..238f625 100644 --- a/src/eventified.ts +++ b/src/eventified.ts @@ -52,15 +52,15 @@ export class Eventified implements IEventEmitter { /** * Gets an array of listeners for a specific event. If no event is provided, it returns all listeners - * @param {string} eventName (Optional) The event name + * @param {string} [event] (Optional) The event name * @returns {EventListener[]} An array of listeners */ - rawListeners(eventName?: string | symbol): EventListener[] { - if (!eventName) { + rawListeners(event?: string | symbol): EventListener[] { + if (!event) { return this.getAllListeners(); } - return this._eventListeners.get(eventName) ?? []; + return this._eventListeners.get(event) ?? []; } /** @@ -153,7 +153,7 @@ export class Eventified implements IEventEmitter { * @param {EventListener} listener * @returns {IEventEmitter} returns the instance of the class for chaining */ - public off(event: string, listener: EventListener): IEventEmitter { + public off(event: string | symbol, listener: EventListener): IEventEmitter { const listeners = this._eventListeners.get(event) ?? []; const index = listeners.indexOf(listener); if (index > -1) { @@ -190,7 +190,7 @@ export class Eventified implements IEventEmitter { /** * Gets all listeners for a specific event. If no event is provided, it returns all listeners - * @param {string} event (Optional) The event name + * @param {string} [event] (Optional) The event name * @returns {EventListener[]} An array of listeners */ public listeners(event: string): EventListener[] { @@ -199,7 +199,7 @@ export class Eventified implements IEventEmitter { /** * Removes all listeners for a specific event. If no event is provided, it removes all listeners - * @param {string} event (Optional) The event name + * @param {string} [event] (Optional) The event name * @returns {IEventEmitter} returns the instance of the class for chaining */ public removeAllListeners(event?: string): IEventEmitter {