Javascript Design Patterns #5 - Observer Pattern

preview_player
Показать описание
What is the Observer design pattern?
The Observer pattern is a design pattern that offers a subscription model in which objects (known as 'observers') can subscribe to an event (known as a 'subject') and get notified when the event occurs (or when the subject sends a signal). This pattern is the cornerstone of event driven programming.

📚Materials/References:

🌎 Find Me Here:

Рекомендации по теме
Комментарии
Автор

Are you a subject? because as an observer, I just subscribed!

tahasaleh
Автор

im not gonna lie..you are the best teacher I've ever had, you literally talk to me like i'm 5 years old. thank you.

js_programmer
Автор

Note: Instead of using fn.call(), you could also just use fn(). They are the same!

DevSage
Автор

This is by far the best explanation I could find on the subject. Great job with this video

CarlitoProductions
Автор

You're a talented teacher, DevSage. Thanks.

HologramJay
Автор

What was demonstrated so nicely in this video is the pubsub pattern. It resembles a lot to the observer pattern and these two are used interchangeably most of the time. There is a subtle difference between them though: pubsub subscribers are not aware of the subject whereas observer subscribers have a reference to the subject

Strasbourgeois
Автор

I finally understood what is going on goooing man.

stud_-ylbu
Автор

You've just got a new subscriber. Great lesson. Keep the good job!

peristiloperis
Автор

The best explanation I seen on YouTube. Thanks a lot!

MegaVladikslavman
Автор

You are the only one who has nicely explain these patterns. Good Work!

KnownTechnical
Автор

Clear explanation with simple examples. Thank you!

juraev
Автор

This was a great explanation of how an event listening system would work in its essence.

I'm not sure if it's a good practice to override the prototype object like you did, but rather extend it.

yamogebrewold
Автор

like how you keep it concise and simple ty

onlyme
Автор

Curly braces on new lines. Prototypal over Pseudoclassical. Based.

RyanFromUltrasound
Автор

Thanks for you "Observations"!

neuodev
Автор

subbed, i already love this channel and ive only seen 3 vids

MrTomro
Автор

Thanks for such a simple and amazing explanation👍

quarantinemade
Автор

One of the best explanations! Thank you.

Videosuser
Автор

One little thing: your code allows you to push the same observer multiple times and it will fire it up multiple times.
It should have check for having observer in array before push

evgenylevchenya
Автор

Finally understood this pattern. Thank you very much!

SiegfriedxD
welcome to shbcf.ru