Tuesday, February 17, 2015

Observer Pattern

Before you start studying the tutorial on events at here, I highly recommend that you understand the Observer Pattern. Then you'll get easier the idea of events in the Shopware framework.

Basic idea of the Observer Pattern:
When an event is fired, it notifies the listeners that are subscribed to it.

Note: listeners can return values and the values can affect the operation of Web pages. For example, a boolean value (true/false) returned by a listener can cause a Web page to get rendered or not (see the example in the section Controller Actions of the tutorial).

event-listeners
event-listener

Here's a good article that explains the Observer Pattern with a piece of code in JavaScript as an example. Please don't dig deep the code. Capture only the concept of the pattern.

No comments:

Post a Comment