Skip to content

Commit

Permalink
Optional typo fix: prepand -> prepend
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloAlexis611 committed Feb 17, 2024
1 parent 2649f5d commit c30b783
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/library/classes/eventEmitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export const EventEmitter: EventEmitterConstructor = class Class implements Even
* @param {string} eventName Event type to listen for
* @param {Function} listener Function to callback on fire
* @param {boolean} [once] Whether to listen for the event only ONCE or not
* @param {boolean} [prepand] Insert the Event in the beginning of the Array, so it executes first
* @param {boolean} [prepend] Insert the Event in the beginning of the Array, so it executes first
*/
private _addListener(eventName: string, listener: (...args: any[]) => void, once?: boolean, prepand?: boolean): void {
private _addListener(eventName: string, listener: (...args: any[]) => void, once?: boolean, prepend?: boolean): void {
const listenerCount = this.listenerCount(eventName);
if(listenerCount >= this._configurations.maxListeners) throw `Warning: Possible EventEmitter memory leak detected. ${listenerCount + 1} ${eventName} listeners added. Use emitter.setMaxListeners(n) to increase limit`;
const data = {
Expand All @@ -24,7 +24,7 @@ export const EventEmitter: EventEmitterConstructor = class Class implements Even
once,
executed: false
};
if(prepand) this._listeners.unshift(data);
if(prepend) this._listeners.unshift(data);
else this._listeners.push(data);
}

Expand Down

0 comments on commit c30b783

Please sign in to comment.