Events and observers
Magento implements the observer pattern through
app/etc/di.xml, there is a preference for
ManagerInterface that points to the
Magento\Framework\Event\Manager\Proxy class type. The
Proxy class further extends the
\Magento\Framework\Event\Manager class that implements the actual event dispatch method.
Events are dispatched by calling a dispatch method on the instance of the
Event\Manager class and passing the name and some data, which is optional, to it. Here's an example of a
Magento core event:
$this->eventManager->dispatch( 'customer_customer_authenticated', ['model' => $this->getFullCustomerObject($customer), 'password' => $password] );
$this->eventManager is an instance of ...