drupal/core/vendor/Symfony/Component/EventDispatcher
James Gilliland 5ae2b93226 Updated Symfony router with HttpKernel request routing 2012-02-13 10:00:36 -05:00
..
Event.php Updated Symfony router with HttpKernel request routing 2012-02-13 10:00:36 -05:00
EventDispatcher.php Updated Symfony router with HttpKernel request routing 2012-02-13 10:00:36 -05:00
EventDispatcherInterface.php Updated Symfony router with HttpKernel request routing 2012-02-13 10:00:36 -05:00
EventSubscriberInterface.php Updated Symfony router with HttpKernel request routing 2012-02-13 10:00:36 -05:00
LICENSE Updated Symfony router with HttpKernel request routing 2012-02-13 10:00:36 -05:00
README.md Updated Symfony router with HttpKernel request routing 2012-02-13 10:00:36 -05:00
composer.json Updated Symfony router with HttpKernel request routing 2012-02-13 10:00:36 -05:00

README.md

EventDispatcher Component

EventDispatcher implements a lightweight version of the Observer design pattern.

use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\Event;

$dispatcher = new EventDispatcher();

$dispatcher->addListener('event_name', function (Event $event) {
    // ...
});

$dispatcher->dispatch('event_name');

Resources

Unit tests:

https://github.com/symfony/symfony/tree/master/tests/Symfony/Tests/Component/EventDispatcher