I am currently following a class about Design Patterns and was wondering whether an EventListener
is an Observable
?
I don't really see a difference between them because both have a list of subscribers and notify these subscribers when something has changed.
An Observable
is simply an object where you can observe it's actions. So anything where you can listen to an action and then be told that action occurs is an Observable
.
This means an Event Listener is one. Because you can listen to events and the events immediately notify you that they have happened.
Personally when anyone says Observable
I think events. This is my cookie cutter example of what observables are. A similar example would be a publish-subscribe system which is just events under a different name (it does have subtly different use case).