Re: Use of Event_Dispatcher package
| From: | Philippe Jausions | Date: | Mon, 28 Feb 2005 19:13:19 +0000 |
| Subject: | Re: Use of Event_Dispatcher package | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-36424@lists.php.net to get a copy of this message | ||
Stephan,
Stephan Schmidt wrote:
Philippe Jausions schrieb:Yes, I thought about something like that too. However, I had some mixed feelings about it, due to the convenience of Event_Dispatcher::getInstance(). I wanted to avoid having multiple instances of Event_Dispatcher going around as it makes more sense to have only one, or at least to have only one way to get it. I also wanted to avoid creating a complete decorator, but that's the least of the concerns... A re-registration of the singleton inside Event_Dispatcher maybe...???1. Event_Dispatcher doesn't seem to have a built-in notification for addObserver and so on...What keeps you from doing something like: File_Monitor_Event_Dispatcher extends Event_Dispatcher { function addObserver(...) {$this->post($this, 'ObserverAdded'); parent::addObserver(...);} } Triggering notifications for every observer added certainly is not a feature I'd like to include in Event_Observer directly, as it can be easily wrapped in a new class...
Yes, changes coming through FAM would be wrapped into a Event_Notification instance. But true, once in the FAM loop of pulling events we pretty much get "stuck" in it. Of course other events be fired by the object processing the FAM event... -Philippe2. FAM supports more features such as Suspend/Resume, event pull.I'm not familiar with the fam extension, but if I unterstand it correctly there is no real event management as you pull all events from a stack. Just transform those to Event_Dispatcher notifications....