Because Gallery 3 is modular in its nature, it’s important to let modules be loosely coupled. Tight bindings between modules (where one module directly calls into another one) reduces modularity and limits the possible ways that Gallery 3 can be deployed.
In Gallery 3, this loose coupling is accomplished by using an event system. Modules can publish arbitrary events whenever they choose, and any other module can listen for that event and take action on it. The gallery module has a set of events that it publishes, and many modules listen for and take action on these events. Event Reference
To implement an event listener for your module, you must create a special kind of helper called example_event. Any event that’s triggered will result in a static method call to this helper. For example, when an Item_Model is saved it will generate a “item_updated” event. This will attempt to call example_event::item_updated(). The item_updated() event takes two arguments, the original Item_Model and the newly updated Item_Model so the event handler can figure out what changed and take an appropriate action.
Notes about events: