Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between "observer" vs. "notify" (in property block) vs. "observers" vs. "listeners" in Polymer

I'm trying to understand the difference between "observer" vs. "notify" in Polymer properties block, and also how they differ from "observers" and "listeners". The online documentation does not seem to elaborate on them.

Could someone explain this to me?

like image 512
np20 Avatar asked Mar 08 '16 16:03

np20


People also ask

Does the observer pattern record change notifications?

The pattern also does not deal with recording when change notifications are sent or guaranteeing that they are being received. These concerns are typically handled in message queueing systems of which the observer pattern is only a small part. Related patterns: Publish–subscribe pattern, mediator, singleton .

What is the difference between a stream of events and observers?

In those systems, the subject is usually named a "stream of events" or "stream source of events", while the observers are called "sinks of events". The stream nomenclature alludes to a physical setup where the observers are physically separated and have no control over the emitted events from the subject/stream-source.

What is the role of an observer?

The responsibility of observers is to register (and unregister) themselves on a subject (to get notified of state changes) and to update their state (synchronize their state with the subject's state) when they are notified. This makes subject and observers loosely coupled.

What is the relationship between a subject and an observer?

The responsibility of observers is to register (and unregister) themselves on a subject (to get notified of state changes) and to update their state (synchronize their state with the subject's state) when they are notified. This makes subject and observers loosely coupled. Subject and observers have no explicit knowledge of each other.


1 Answers

  • notify fires an event to notify parents about changed properties
  • observer is a function called when a property changes
  • listeners is an event handler called when a specific event was recieved
like image 185
Günter Zöchbauer Avatar answered Oct 08 '22 00:10

Günter Zöchbauer