The Event Emitter (PyEventsEmitter) is a powerful tool for managing event listeners and emitting events in your application. It provides a range of methods for adding, removing, and checking listeners, as well as emitting events with arguments.
pip install PyEventsEmitterInitializes a new instance of the Event Emitter class. The options parameter is an optional dictionary containing configuration options for the Event Emitter. If provided, the captureRejections flag is set to the value of the 'captureRejections' key in the options dictionary. If the 'captureRejections' key is not present in the options dictionary, or if options is None, the captureRejections flag is set to False.
events: A dictionary storing event listeners.captureRejections: A flag indicating whether the Event Emitter captures and emits rejections.
Adds a listener to the specified event.
Removes a listener from the specified event.
Emits an event with the given name and arguments.
Adds a listener to the specified event that will be executed only once.
Returns a list of listeners for the specified event name.
Returns the number of listeners for the specified event name.
Removes a listener from the specified event.
Removes all listeners for the specified event or all events if no event name is provided.
Sets the maximum number of listeners for the event emitter.
Returns the maximum number of listeners for the event emitter.
Adds a listener to the beginning of the listeners array for the specified event.
Adds a one-time listener function to the beginning of the listeners array for the specified event.
Returns a list of event names.
Adds an abort listener to the event emitter.
Gets the current setting for capturing rejection events.
Returns the default maximum number of listeners allowed per event.