@inweb/eventemitter2 26.3.1 → 26.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
1
+ Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
2
2
  All rights reserved.
3
3
 
4
4
  This software and its documentation and related materials are owned by
@@ -13,7 +13,7 @@ with their copyright notices:
13
13
 
14
14
  This application incorporates Open Design Alliance software pursuant to a
15
15
  license agreement with Open Design Alliance.
16
- Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
16
+ Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
17
17
  All rights reserved.
18
18
 
19
19
  By use of this software, its documentation or related materials, you
package/README.md CHANGED
@@ -4,4 +4,4 @@ JavaScript event emitter.
4
4
 
5
5
  ## Copyright and license
6
6
 
7
- Code and documentation copyright 2002-2024 the [Open Design Alliance](https://opendesign.com). Code is distributed under a proprietary license, see [LICENSE](./LICENSE) for more information.
7
+ Code and documentation copyright 2002-2025 the [Open Design Alliance](https://opendesign.com). Code is distributed under a proprietary license, see [LICENSE](./LICENSE) for more information.
@@ -5,7 +5,7 @@
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
7
  ///////////////////////////////////////////////////////////////////////////////
8
- // Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
8
+ // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
9
9
  // All rights reserved.
10
10
  //
11
11
  // This software and its documentation and related materials are owned by
@@ -20,7 +20,7 @@
20
20
  //
21
21
  // This application incorporates Open Design Alliance software pursuant to a
22
22
  // license agreement with Open Design Alliance.
23
- // Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
23
+ // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
24
24
  // All rights reserved.
25
25
  //
26
26
  // By use of this software, its documentation or related materials, you
@@ -1 +1 @@
1
- {"version":3,"file":"eventemitter2.js","sources":["../src/index.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\n/**\n * The event interface for {@link IEventEmitter}.\n */\nexport interface IEvent {\n /**\n * Event type.\n */\n type: string;\n}\n\n/**\n * Event emitter interface.\n */\nexport interface IEventEmitter {\n /**\n * Registers a new listener for the event type.\n *\n * @param type - The type of event to listen to.\n * @param listener - The function that gets called when the event is fired.\n */\n addEventListener(type: string, listener: (event: IEvent) => void): this;\n\n /**\n * Removes the listener for the event type.\n *\n * @param type - The type of the event that gets removed.\n * @param listener - The listener function that gets removed.\n */\n removeEventListener(type: string, listener: (event: IEvent) => void): this;\n\n /**\n * If `type` is specified, removes all registered listeners for type, otherwise removes all registered\n * listeners.\n *\n * @param type - The type of the listener that gets removed.\n */\n removeAllListeners(type?: string): this;\n\n /**\n * Fires the event. Calls each of the listeners registered for the event type `event.type`, in the\n * order they were registered.\n *\n * @param event - The event that gets fired.\n */\n emitEvent(event: IEvent): boolean;\n\n // Node.js style, to emit custom eventsg\n\n /**\n * Registers a new listener for the event type. Alias to {@link addEventListener | addEventListener()}\n *\n * @param type - The type of event to listen to.\n * @param listener - The function that gets called when the event is fired.\n */\n on(type: string, listener: (event: any) => void): this;\n\n /**\n * Removes the listener from an event type. Alias to\n * {@link removeEventListener | removeEventListener()}.\n *\n * @param type - The type of the event that gets removed.\n * @param listener - The listener function that gets removed.\n */\n off(type: string, listener: (event: any) => void): this;\n\n /**\n * Fires the event. Alias to {@link emitEvent | emitEvent()}.\n *\n * @param type - The type of event that gets fired.\n * @param args - The event properties.\n */\n emit(type: string | object, ...args: any[]): boolean;\n}\n\n/**\n * The minimal basic event that can be emitted by a {@link EventEmitter2}.\n */\nexport interface Event<T extends string = string> extends IEvent {\n /**\n * Event type.\n */\n type: T;\n}\n\n/**\n * Event emitter for custom objects.\n */\nexport class EventEmitter2<EventMap extends Record<string, any> = Record<string, any>> implements IEventEmitter {\n private _listeners: Record<any, any[]> = {};\n\n addEventListener<T extends keyof EventMap>(type: T, listener: (event: EventMap[T]) => void): this {\n if (this._listeners[type] === undefined) this._listeners[type] = [];\n this._listeners[type].push(listener);\n return this;\n }\n\n removeEventListener<T extends keyof EventMap>(type: T, listener: (event: EventMap[T]) => void): this {\n if (this._listeners[type] === undefined) return this;\n const listeners = this._listeners[type].filter((x: any) => x !== listener);\n if (listeners.length !== 0) this._listeners[type] = listeners;\n else delete this._listeners[type];\n return this;\n }\n\n removeAllListeners<T extends keyof EventMap>(type?: T): this {\n if (type) delete this._listeners[type];\n else this._listeners = {};\n return this;\n }\n\n emitEvent<T extends keyof EventMap>(event: Event<Extract<T, string>> & EventMap[T]): boolean {\n if (this._listeners[event.type] === undefined) return false;\n const invoke = this._listeners[event.type].slice();\n invoke.forEach((listener: any) => listener.call(this, event));\n return true;\n }\n\n on(type: string, listener: (event: any) => void): this {\n return this.addEventListener(type as any, listener as any);\n }\n\n off(type: string, listener: (event: any) => void): this {\n return this.removeEventListener(type as any, listener as any);\n }\n\n emit(type: string | object, ...args: any[]): boolean {\n if (typeof type === \"string\") return this.emitEvent({ type, args } as any);\n else if (typeof type === \"object\") return this.emitEvent(type as any);\n else return false;\n }\n}\n"],"names":[],"mappings":";;;;;;IAAA;IACA;IACA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IAC3D,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE;IAClD,QAAA,MAAM,CAAC,OAAO,CAAC,CAAC,QAAa,KAAK,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC7D,QAAA,OAAO,IAAI;;QAGb,EAAE,CAAC,IAAY,EAAE,QAA8B,EAAA;YAC7C,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAW,EAAE,QAAe,CAAC;;QAG5D,GAAG,CAAC,IAAY,EAAE,QAA8B,EAAA;YAC9C,OAAO,IAAI,CAAC,mBAAmB,CAAC,IAAW,EAAE,QAAe,CAAC;;IAG/D,IAAA,IAAI,CAAC,IAAqB,EAAE,GAAG,IAAW,EAAA;YACxC,IAAI,OAAO,IAAI,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAS,CAAC;iBACrE,IAAI,OAAO,IAAI,KAAK,QAAQ;IAAE,YAAA,OAAO,IAAI,CAAC,SAAS,CAAC,IAAW,CAAC;;IAChE,YAAA,OAAO,KAAK;;IAEpB;;;;;;;;"}
1
+ {"version":3,"file":"eventemitter2.js","sources":["../src/index.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2025, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\n/**\n * The event interface for {@link IEventEmitter}.\n */\nexport interface IEvent {\n /**\n * Event type.\n */\n type: string;\n}\n\n/**\n * Event emitter interface.\n */\nexport interface IEventEmitter {\n /**\n * Registers a new listener for the event type.\n *\n * @param type - The type of event to listen to.\n * @param listener - The function that gets called when the event is fired.\n */\n addEventListener(type: string, listener: (event: IEvent) => void): this;\n\n /**\n * Removes the listener for the event type.\n *\n * @param type - The type of the event that gets removed.\n * @param listener - The listener function that gets removed.\n */\n removeEventListener(type: string, listener: (event: IEvent) => void): this;\n\n /**\n * If `type` is specified, removes all registered listeners for type, otherwise removes all registered\n * listeners.\n *\n * @param type - The type of the listener that gets removed.\n */\n removeAllListeners(type?: string): this;\n\n /**\n * Fires the event. Calls each of the listeners registered for the event type `event.type`, in the\n * order they were registered.\n *\n * @param event - The event that gets fired.\n */\n emitEvent(event: IEvent): boolean;\n\n // Node.js style, to emit custom eventsg\n\n /**\n * Registers a new listener for the event type. Alias to {@link addEventListener | addEventListener()}\n *\n * @param type - The type of event to listen to.\n * @param listener - The function that gets called when the event is fired.\n */\n on(type: string, listener: (event: any) => void): this;\n\n /**\n * Removes the listener from an event type. Alias to\n * {@link removeEventListener | removeEventListener()}.\n *\n * @param type - The type of the event that gets removed.\n * @param listener - The listener function that gets removed.\n */\n off(type: string, listener: (event: any) => void): this;\n\n /**\n * Fires the event. Alias to {@link emitEvent | emitEvent()}.\n *\n * @param type - The type of event that gets fired.\n * @param args - The event properties.\n */\n emit(type: string | object, ...args: any[]): boolean;\n}\n\n/**\n * The minimal basic event that can be emitted by a {@link EventEmitter2}.\n */\nexport interface Event<T extends string = string> extends IEvent {\n /**\n * Event type.\n */\n type: T;\n}\n\n/**\n * Event emitter for custom objects.\n */\nexport class EventEmitter2<EventMap extends Record<string, any> = Record<string, any>> implements IEventEmitter {\n private _listeners: Record<any, any[]> = {};\n\n addEventListener<T extends keyof EventMap>(type: T, listener: (event: EventMap[T]) => void): this {\n if (this._listeners[type] === undefined) this._listeners[type] = [];\n this._listeners[type].push(listener);\n return this;\n }\n\n removeEventListener<T extends keyof EventMap>(type: T, listener: (event: EventMap[T]) => void): this {\n if (this._listeners[type] === undefined) return this;\n const listeners = this._listeners[type].filter((x: any) => x !== listener);\n if (listeners.length !== 0) this._listeners[type] = listeners;\n else delete this._listeners[type];\n return this;\n }\n\n removeAllListeners<T extends keyof EventMap>(type?: T): this {\n if (type) delete this._listeners[type];\n else this._listeners = {};\n return this;\n }\n\n emitEvent<T extends keyof EventMap>(event: Event<Extract<T, string>> & EventMap[T]): boolean {\n if (this._listeners[event.type] === undefined) return false;\n const invoke = this._listeners[event.type].slice();\n invoke.forEach((listener: any) => listener.call(this, event));\n return true;\n }\n\n on(type: string, listener: (event: any) => void): this {\n return this.addEventListener(type as any, listener as any);\n }\n\n off(type: string, listener: (event: any) => void): this {\n return this.removeEventListener(type as any, listener as any);\n }\n\n emit(type: string | object, ...args: any[]): boolean {\n if (typeof type === \"string\") return this.emitEvent({ type, args } as any);\n else if (typeof type === \"object\") return this.emitEvent(type as any);\n else return false;\n }\n}\n"],"names":[],"mappings":";;;;;;IAAA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAsFA;;IAEG;UACU,aAAa,CAAA;IAA1B,IAAA,WAAA,GAAA;YACU,IAAU,CAAA,UAAA,GAAuB,EAAE;;QAE3C,gBAAgB,CAA2B,IAAO,EAAE,QAAsC,EAAA;IACxF,QAAA,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,SAAS;IAAE,YAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE;YACnE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IACpC,QAAA,OAAO,IAAI;;QAGb,mBAAmB,C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,IAAqB,EAAE,GAAG,IAAW,EAAA;YACxC,IAAI,OAAO,IAAI,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAS,CAAC;iBACrE,IAAI,OAAO,IAAI,KAAK,QAAQ;IAAE,YAAA,OAAO,IAAI,CAAC,SAAS,CAAC,IAAW,CAAC;;IAChE,YAAA,OAAO,KAAK;;IAEpB;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"eventemitter2.module.js","sources":["../src/index.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2024, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\n/**\n * The event interface for {@link IEventEmitter}.\n */\nexport interface IEvent {\n /**\n * Event type.\n */\n type: string;\n}\n\n/**\n * Event emitter interface.\n */\nexport interface IEventEmitter {\n /**\n * Registers a new listener for the event type.\n *\n * @param type - The type of event to listen to.\n * @param listener - The function that gets called when the event is fired.\n */\n addEventListener(type: string, listener: (event: IEvent) => void): this;\n\n /**\n * Removes the listener for the event type.\n *\n * @param type - The type of the event that gets removed.\n * @param listener - The listener function that gets removed.\n */\n removeEventListener(type: string, listener: (event: IEvent) => void): this;\n\n /**\n * If `type` is specified, removes all registered listeners for type, otherwise removes all registered\n * listeners.\n *\n * @param type - The type of the listener that gets removed.\n */\n removeAllListeners(type?: string): this;\n\n /**\n * Fires the event. Calls each of the listeners registered for the event type `event.type`, in the\n * order they were registered.\n *\n * @param event - The event that gets fired.\n */\n emitEvent(event: IEvent): boolean;\n\n // Node.js style, to emit custom eventsg\n\n /**\n * Registers a new listener for the event type. Alias to {@link addEventListener | addEventListener()}\n *\n * @param type - The type of event to listen to.\n * @param listener - The function that gets called when the event is fired.\n */\n on(type: string, listener: (event: any) => void): this;\n\n /**\n * Removes the listener from an event type. Alias to\n * {@link removeEventListener | removeEventListener()}.\n *\n * @param type - The type of the event that gets removed.\n * @param listener - The listener function that gets removed.\n */\n off(type: string, listener: (event: any) => void): this;\n\n /**\n * Fires the event. Alias to {@link emitEvent | emitEvent()}.\n *\n * @param type - The type of event that gets fired.\n * @param args - The event properties.\n */\n emit(type: string | object, ...args: any[]): boolean;\n}\n\n/**\n * The minimal basic event that can be emitted by a {@link EventEmitter2}.\n */\nexport interface Event<T extends string = string> extends IEvent {\n /**\n * Event type.\n */\n type: T;\n}\n\n/**\n * Event emitter for custom objects.\n */\nexport class EventEmitter2<EventMap extends Record<string, any> = Record<string, any>> implements IEventEmitter {\n private _listeners: Record<any, any[]> = {};\n\n addEventListener<T extends keyof EventMap>(type: T, listener: (event: EventMap[T]) => void): this {\n if (this._listeners[type] === undefined) this._listeners[type] = [];\n this._listeners[type].push(listener);\n return this;\n }\n\n removeEventListener<T extends keyof EventMap>(type: T, listener: (event: EventMap[T]) => void): this {\n if (this._listeners[type] === undefined) return this;\n const listeners = this._listeners[type].filter((x: any) => x !== listener);\n if (listeners.length !== 0) this._listeners[type] = listeners;\n else delete this._listeners[type];\n return this;\n }\n\n removeAllListeners<T extends keyof EventMap>(type?: T): this {\n if (type) delete this._listeners[type];\n else this._listeners = {};\n return this;\n }\n\n emitEvent<T extends keyof EventMap>(event: Event<Extract<T, string>> & EventMap[T]): boolean {\n if (this._listeners[event.type] === undefined) return false;\n const invoke = this._listeners[event.type].slice();\n invoke.forEach((listener: any) => listener.call(this, event));\n return true;\n }\n\n on(type: string, listener: (event: any) => void): this {\n return this.addEventListener(type as any, listener as any);\n }\n\n off(type: string, listener: (event: any) => void): this {\n return this.removeEventListener(type as any, listener as any);\n }\n\n emit(type: string | object, ...args: any[]): boolean {\n if (typeof type === \"string\") return this.emitEvent({ type, args } as any);\n else if (typeof type === \"object\") return this.emitEvent(type as any);\n else return false;\n }\n}\n"],"names":["EventEmitter2","constructor","this","_listeners","addEventListener","type","listener","undefined","push","removeEventListener","listeners","filter","x","length","removeAllListeners","emitEvent","event","invoke","slice","forEach","call","on","off","emit","args"],"mappings":"MA8GaA;IAAb,WAAAC;QACUC,KAAUC,aAAuB,CAAE;;IAE3C,gBAAAC,CAA2CC,MAASC;QAClD,IAAIJ,KAAKC,WAAWE,UAAUE,WAAWL,KAAKC,WAAWE,QAAQ;QACjEH,KAAKC,WAAWE,MAAMG,KAAKF;QAC3B,OAAOJ;;IAGT,mBAAAO,CAA8CJ,MAASC;QACrD,IAAIJ,KAAKC,WAAWE,UAAUE,WAAW,OAAOL;QAChD,MAAMQ,YAAYR,KAAKC,WAAWE,MAAMM,QAAQC,KAAWA,MAAMN;QACjE,IAAII,UAAUG,WAAW,GAAGX,KAAKC,WAAWE,QAAQK,uBACxCR,KAAKC,WAAWE;QAC5B,OAAOH;;IAGT,kBAAAY,CAA6CT;QAC3C,IAAIA,aAAaH,KAAKC,WAAWE,YAC5BH,KAAKC,aAAa,CAAE;QACzB,OAAOD;;IAGT,SAAAa,CAAoCC;QAClC,IAAId,KAAKC,WAAWa,MAAMX,UAAUE,WAAW,OAAO;QACtD,MAAMU,SAASf,KAAKC,WAAWa,MAAMX,MAAMa;QAC3CD,OAAOE,SAASb,YAAkBA,SAASc,KAAKlB,MAAMc;QACtD,OAAO;;IAGT,EAAAK,CAAGhB,MAAcC;QACf,OAAOJ,KAAKE,iBAAiBC,MAAaC;;IAG5C,GAAAgB,CAAIjB,MAAcC;QAChB,OAAOJ,KAAKO,oBAAoBJ,MAAaC;;IAG/C,IAAAiB,CAAKlB,SAA0BmB;QAC7B,WAAWnB,SAAS,UAAU,OAAOH,KAAKa,UAAU;YAAEV;YAAMmB;iBACvD,WAAWnB,SAAS,UAAU,OAAOH,KAAKa,UAAUV,YACpD,OAAO;;;;"}
1
+ {"version":3,"file":"eventemitter2.module.js","sources":["../src/index.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2025, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\n/**\n * The event interface for {@link IEventEmitter}.\n */\nexport interface IEvent {\n /**\n * Event type.\n */\n type: string;\n}\n\n/**\n * Event emitter interface.\n */\nexport interface IEventEmitter {\n /**\n * Registers a new listener for the event type.\n *\n * @param type - The type of event to listen to.\n * @param listener - The function that gets called when the event is fired.\n */\n addEventListener(type: string, listener: (event: IEvent) => void): this;\n\n /**\n * Removes the listener for the event type.\n *\n * @param type - The type of the event that gets removed.\n * @param listener - The listener function that gets removed.\n */\n removeEventListener(type: string, listener: (event: IEvent) => void): this;\n\n /**\n * If `type` is specified, removes all registered listeners for type, otherwise removes all registered\n * listeners.\n *\n * @param type - The type of the listener that gets removed.\n */\n removeAllListeners(type?: string): this;\n\n /**\n * Fires the event. Calls each of the listeners registered for the event type `event.type`, in the\n * order they were registered.\n *\n * @param event - The event that gets fired.\n */\n emitEvent(event: IEvent): boolean;\n\n // Node.js style, to emit custom eventsg\n\n /**\n * Registers a new listener for the event type. Alias to {@link addEventListener | addEventListener()}\n *\n * @param type - The type of event to listen to.\n * @param listener - The function that gets called when the event is fired.\n */\n on(type: string, listener: (event: any) => void): this;\n\n /**\n * Removes the listener from an event type. Alias to\n * {@link removeEventListener | removeEventListener()}.\n *\n * @param type - The type of the event that gets removed.\n * @param listener - The listener function that gets removed.\n */\n off(type: string, listener: (event: any) => void): this;\n\n /**\n * Fires the event. Alias to {@link emitEvent | emitEvent()}.\n *\n * @param type - The type of event that gets fired.\n * @param args - The event properties.\n */\n emit(type: string | object, ...args: any[]): boolean;\n}\n\n/**\n * The minimal basic event that can be emitted by a {@link EventEmitter2}.\n */\nexport interface Event<T extends string = string> extends IEvent {\n /**\n * Event type.\n */\n type: T;\n}\n\n/**\n * Event emitter for custom objects.\n */\nexport class EventEmitter2<EventMap extends Record<string, any> = Record<string, any>> implements IEventEmitter {\n private _listeners: Record<any, any[]> = {};\n\n addEventListener<T extends keyof EventMap>(type: T, listener: (event: EventMap[T]) => void): this {\n if (this._listeners[type] === undefined) this._listeners[type] = [];\n this._listeners[type].push(listener);\n return this;\n }\n\n removeEventListener<T extends keyof EventMap>(type: T, listener: (event: EventMap[T]) => void): this {\n if (this._listeners[type] === undefined) return this;\n const listeners = this._listeners[type].filter((x: any) => x !== listener);\n if (listeners.length !== 0) this._listeners[type] = listeners;\n else delete this._listeners[type];\n return this;\n }\n\n removeAllListeners<T extends keyof EventMap>(type?: T): this {\n if (type) delete this._listeners[type];\n else this._listeners = {};\n return this;\n }\n\n emitEvent<T extends keyof EventMap>(event: Event<Extract<T, string>> & EventMap[T]): boolean {\n if (this._listeners[event.type] === undefined) return false;\n const invoke = this._listeners[event.type].slice();\n invoke.forEach((listener: any) => listener.call(this, event));\n return true;\n }\n\n on(type: string, listener: (event: any) => void): this {\n return this.addEventListener(type as any, listener as any);\n }\n\n off(type: string, listener: (event: any) => void): this {\n return this.removeEventListener(type as any, listener as any);\n }\n\n emit(type: string | object, ...args: any[]): boolean {\n if (typeof type === \"string\") return this.emitEvent({ type, args } as any);\n else if (typeof type === \"object\") return this.emitEvent(type as any);\n else return false;\n }\n}\n"],"names":["EventEmitter2","constructor","this","_listeners","addEventListener","type","listener","undefined","push","removeEventListener","listeners","filter","x","length","removeAllListeners","emitEvent","event","invoke","slice","forEach","call","on","off","emit","args"],"mappings":"MA8GaA;IAAb,WAAAC;QACUC,KAAUC,aAAuB,CAAE;;IAE3C,gBAAAC,CAA2CC,MAASC;QAClD,IAAIJ,KAAKC,WAAWE,UAAUE,WAAWL,KAAKC,WAAWE,QAAQ;QACjEH,KAAKC,WAAWE,MAAMG,KAAKF;QAC3B,OAAOJ;;IAGT,mBAAAO,CAA8CJ,MAASC;QACrD,IAAIJ,KAAKC,WAAWE,UAAUE,WAAW,OAAOL;QAChD,MAAMQ,YAAYR,KAAKC,WAAWE,MAAMM,QAAQC,KAAWA,MAAMN;QACjE,IAAII,UAAUG,WAAW,GAAGX,KAAKC,WAAWE,QAAQK,uBACxCR,KAAKC,WAAWE;QAC5B,OAAOH;;IAGT,kBAAAY,CAA6CT;QAC3C,IAAIA,aAAaH,KAAKC,WAAWE,YAC5BH,KAAKC,aAAa,CAAE;QACzB,OAAOD;;IAGT,SAAAa,CAAoCC;QAClC,IAAId,KAAKC,WAAWa,MAAMX,UAAUE,WAAW,OAAO;QACtD,MAAMU,SAASf,KAAKC,WAAWa,MAAMX,MAAMa;QAC3CD,OAAOE,SAASb,YAAkBA,SAASc,KAAKlB,MAAMc;QACtD,OAAO;;IAGT,EAAAK,CAAGhB,MAAcC;QACf,OAAOJ,KAAKE,iBAAiBC,MAAaC;;IAG5C,GAAAgB,CAAIjB,MAAcC;QAChB,OAAOJ,KAAKO,oBAAoBJ,MAAaC;;IAG/C,IAAAiB,CAAKlB,SAA0BmB;QAC7B,WAAWnB,SAAS,UAAU,OAAOH,KAAKa,UAAU;YAAEV;YAAMmB;iBACvD,WAAWnB,SAAS,UAAU,OAAOH,KAAKa,UAAUV,YACpD,OAAO;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/eventemitter2",
3
- "version": "26.3.1",
3
+ "version": "26.3.2",
4
4
  "description": "JavaScript event emitter",
5
5
  "homepage": "https://cloud.opendesign.com/docs/index.html",
6
6
  "license": "SEE LICENSE IN LICENSE",
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  ///////////////////////////////////////////////////////////////////////////////
2
- // Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
2
+ // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
3
3
  // All rights reserved.
4
4
  //
5
5
  // This software and its documentation and related materials are owned by
@@ -14,7 +14,7 @@
14
14
  //
15
15
  // This application incorporates Open Design Alliance software pursuant to a
16
16
  // license agreement with Open Design Alliance.
17
- // Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
17
+ // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
18
18
  // All rights reserved.
19
19
  //
20
20
  // By use of this software, its documentation or related materials, you