# 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
```sh
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/HackerX7889/PyEventsEmitter",
"name": "PyEventsEmitter",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "EventEmitter, PyEventsEmitter, Emitter, Events",
"author": "HackerX",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/d3/6b/8433598bf5b1d4affd78ea6ee74e5aa15fda311986d06d9df1b563a3a1d8/PyEventsEmitter-0.0.3.tar.gz",
"platform": null,
"description": "\r\n# Event Emitter\r\n\r\n\r\n\r\n### Overview\r\n\r\n------------\r\n\r\n\r\n\r\nThe 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.\r\n\r\n\r\n\r\n## Installation\r\n\r\n\r\n\r\n```sh\r\n\r\npip install PyEventsEmitter\r\n\r\n```\r\n\r\n\r\n\r\n### Initialization\r\n\r\n-----------------\r\n\r\n\r\n\r\n### `__init__(options: Optional[Dict[str, Any]] | None) -> None`\r\n\r\nInitializes 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`.\r\n\r\n\r\n\r\n### `events` and `captureRejections` Attributes\r\n\r\n-----------------------------------------\r\n\r\n\r\n\r\n- `events`: A dictionary storing event listeners.\r\n\r\n- `captureRejections`: A flag indicating whether the Event Emitter captures and emits rejections.\r\n\r\n\r\n\r\n### Methods\r\n\r\n---------\r\n\r\n\r\n\r\n### `on(event_name: str, listener: Callable[..., None]) -> None`\r\n\r\nAdds a listener to the specified event.\r\n\r\n\r\n\r\n### `off(event_name: str, listener: Callable[..., None]) -> None`\r\n\r\nRemoves a listener from the specified event.\r\n\r\n\r\n\r\n### `emit(event_name: str, *args: Any) -> self`\r\n\r\nEmits an event with the given name and arguments.\r\n\r\n\r\n\r\n### `once(event_name: str, listener: Callable[..., None]) -> self`\r\n\r\nAdds a listener to the specified event that will be executed only once.\r\n\r\n\r\n\r\n### `listeners(event_name: str) -> List[Callable[..., None]]`\r\n\r\nReturns a list of listeners for the specified event name.\r\n\r\n\r\n\r\n### `listener_count(event_name: str) -> int`\r\n\r\nReturns the number of listeners for the specified event name.\r\n\r\n\r\n\r\n### `remove_listener(event_name: str, listener: Callable[..., None]) -> self`\r\n\r\nRemoves a listener from the specified event.\r\n\r\n\r\n\r\n### `remove_all_listeners(event_name: Optional[str] = None) -> self`\r\n\r\nRemoves all listeners for the specified event or all events if no event name is provided.\r\n\r\n\r\n\r\n### `set_max_listeners(n: int) -> self`\r\n\r\nSets the maximum number of listeners for the event emitter.\r\n\r\n\r\n\r\n### `get_max_listeners() -> int`\r\n\r\nReturns the maximum number of listeners for the event emitter.\r\n\r\n\r\n\r\n### `prependListener(event_name: str, listener: Callable[..., None]) -> self`\r\n\r\nAdds a listener to the beginning of the listeners array for the specified event.\r\n\r\n\r\n\r\n### `prependOnceListener(event_name: str, listener: Callable[..., None]) -> self`\r\n\r\nAdds a one-time listener function to the beginning of the listeners array for the specified event.\r\n\r\n\r\n\r\n### `event_names() -> List[str]`\r\n\r\nReturns a list of event names.\r\n\r\n\r\n\r\n### `addAbortListener(signal: AbortSignal, resource: Callable[[str], None]) -> Disposable`\r\n\r\nAdds an abort listener to the event emitter.\r\n\r\n\r\n\r\n### `captureRejection() -> bool`\r\n\r\nGets the current setting for capturing rejection events.\r\n\r\n\r\n\r\n### `defaultMaxListeners() -> int`\r\n\r\nReturns the default maximum number of listeners allowed per event.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Powerful and flexible EventEmitter implementation with advanced features.",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/HackerX7889/PyEventsEmitter"
},
"split_keywords": [
"eventemitter",
" pyeventsemitter",
" emitter",
" events"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5c2f7328b917b08f423f7ceec2b33b4ef344e7579444216409aef709a6fd1e0c",
"md5": "dba1a601d10abb8740e29730e54a9f55",
"sha256": "d82983aa1cd60514ac744e5564e153040deb2505d16ce923b4e86e68ec1110f6"
},
"downloads": -1,
"filename": "PyEventsEmitter-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dba1a601d10abb8740e29730e54a9f55",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6630,
"upload_time": "2024-06-10T08:27:32",
"upload_time_iso_8601": "2024-06-10T08:27:32.570225Z",
"url": "https://files.pythonhosted.org/packages/5c/2f/7328b917b08f423f7ceec2b33b4ef344e7579444216409aef709a6fd1e0c/PyEventsEmitter-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d36b8433598bf5b1d4affd78ea6ee74e5aa15fda311986d06d9df1b563a3a1d8",
"md5": "57112abe4a470645ae4997fc8296b6d4",
"sha256": "bcffbcc106ca7830a78e7f29c6282d3f348f69c58ffd548b892b37c5ccd172ee"
},
"downloads": -1,
"filename": "PyEventsEmitter-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "57112abe4a470645ae4997fc8296b6d4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5862,
"upload_time": "2024-06-10T08:27:34",
"upload_time_iso_8601": "2024-06-10T08:27:34.340643Z",
"url": "https://files.pythonhosted.org/packages/d3/6b/8433598bf5b1d4affd78ea6ee74e5aa15fda311986d06d9df1b563a3a1d8/PyEventsEmitter-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-10 08:27:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "HackerX7889",
"github_project": "PyEventsEmitter",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pyeventsemitter"
}