Event Emitter
Overview
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.
Installation
pip install PyEventsEmitter
Initialization
__init__(options: Optional[Dict[str, Any]] | None) -> None
Initializes 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 and captureRejections Attributes
-
events: A dictionary storing event listeners. -
captureRejections: A flag indicating whether the Event Emitter captures and emits rejections.
Methods
on(event_name: str, listener: Callable[..., None]) -> None
Adds a listener to the specified event.
off(event_name: str, listener: Callable[..., None]) -> None
Removes a listener from the specified event.
emit(event_name: str, *args: Any) -> self
Emits an event with the given name and arguments.
once(event_name: str, listener: Callable[..., None]) -> self
Adds a listener to the specified event that will be executed only once.
listeners(event_name: str) -> List[Callable[..., None]]
Returns a list of listeners for the specified event name.
listener_count(event_name: str) -> int
Returns the number of listeners for the specified event name.
remove_listener(event_name: str, listener: Callable[..., None]) -> self
Removes a listener from the specified event.
remove_all_listeners(event_name: Optional[str] = None) -> self
Removes all listeners for the specified event or all events if no event name is provided.
set_max_listeners(n: int) -> self
Sets the maximum number of listeners for the event emitter.
get_max_listeners() -> int
Returns the maximum number of listeners for the event emitter.
prependListener(event_name: str, listener: Callable[..., None]) -> self
Adds a listener to the beginning of the listeners array for the specified event.
prependOnceListener(event_name: str, listener: Callable[..., None]) -> self
Adds a one-time listener function to the beginning of the listeners array for the specified event.
event_names() -> List[str]
Returns a list of event names.
addAbortListener(signal: AbortSignal, resource: Callable[[str], None]) -> Disposable
Adds an abort listener to the event emitter.
captureRejection() -> bool
Gets the current setting for capturing rejection events.
defaultMaxListeners() -> int
Returns the default maximum number of listeners allowed per event.
Metadata
Release files for PyEventsEmitter 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| PyEventsEmitter-0.0.3.tar.gz | 5.9 kB | Without provenance | Details for PyEventsEmitter-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| PyEventsEmitter-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for PyEventsEmitter-0.0.3-py3-none-any.whl |
Total release size: 12.5 kB
Release files / PyEventsEmitter-0.0.3.tar.gz
| Download URL | PyEventsEmitter-0.0.3.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bcffbcc106ca7830a78e7f29c6282d3f348f69c58ffd548b892b37c5ccd172ee
|
|
BLAKE2b-256 checksum How to use checksums |
d36b8433598bf5b1d4affd78ea6ee74e5aa15fda311986d06d9df1b563a3a1d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.10.9
|
Release files / PyEventsEmitter-0.0.3-py3-none-any.whl
| Download URL | PyEventsEmitter-0.0.3-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d82983aa1cd60514ac744e5564e153040deb2505d16ce923b4e86e68ec1110f6
|
|
BLAKE2b-256 checksum How to use checksums |
5c2f7328b917b08f423f7ceec2b33b4ef344e7579444216409aef709a6fd1e0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.10.9
|
Security for PyEventsEmitter 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.