|
What is an event handler |
object that has been registered for receiving a method call when an event occurs |
PhpPeanuts has a very simple interpretation of event handling: an object can be registered to receive a method call. The method called has the same name as the event. The event itself may not be an object, it may just be a name.
The parameters that will be passed with the call are defined by the event handing method that is defined by the same object where to register the event handler. The default event handler method can be copied to another class and will then work just the same.
Example 8 shows the registering of an event handler and event handling method implementation. |
|