nuxed / event-dispatcher
Nuxed Event Dispatcher
Installs: 163
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Language:Hack
Requires
- hhvm: ~4.83.1 || ~4.84.0 || ~4.85.0
- hhvm/hsl: ^4.41
- nuxed/contract: ^2.0
Requires (Dev)
- facebook/difflib: ^1.1.1
- facebook/fbexpect: ^2.7.7
- facebook/hh-clilib: ^2.5.2
- hhvm/hacktest: ^2.0
- hhvm/hhast: ^4.82.2
- hhvm/hhvm-autoload: ^3.1.6
- hhvm/type-assert: ^4.1.2
This package is auto-updated.
Last update: 2024-12-22 07:43:40 UTC
README
Nuxed Event Dispatcher
The Event Dispatcher component provides tools that allow your application components to communicate with each other by dispatching events and listening to them asynchronously.
Installation
This package can be installed with Composer.
$ composer require nuxed/event-dispatcher
Example
use namespace Nuxed\EventDispatcher; use namespace Nuxed\EventDispatcher\ListenerProvider; <<__EntryPoint>> async function main(): Awaitable<void> { $provider = new ListenerProvider\AttachableListenerProvider(); $provider->listen<SomeEvent>(new SomeEventListener()); $provider->listen<SomeOtherEvent>(new SomeOtherEventListener()); $dispatcher = new EventDispatcher\EventDispatcher($provider); // dispatch multiple event listeners concurrently concurrent { // returns the event that was passed, now modified by listeners. $someEvent = await $dispatcher->dispatch<SomeEvent>(new SomeEvent()); $someOtherEvent = await $dispatcher->dispatch<SomeOtherEvent>(new SomeOtherEvent()); } }
Security
For information on reporting security vulnerabilities in Nuxed, see SECURITY.md.
License
Nuxed is open-sourced software licensed under the MIT-licensed.