Observer Pattern - Design Patterns in JavaScript

Pubblicato il: 24 marzo 2022
sul canale di: TomDoesTech
8,355
256

Repository: https://github.com/TomDoesTech/js-des...

The observer pattern makes use of observable objects to make your code reactive. An observable is an object (the subject) that maintains a list of dependents (observers) and notifies them when the state changes, usually by calling a broadcast method.

An example of the observable pattern is EventTarget.addEventListener(). addEventListener allows you to subscribe to an event on the DOM and provide a callback function. When that event happens, your callback function will be executed.

0:00 Introduction
1:37 Create observable with a class
3:46 Using the observable
5:05 Observable factory function
6:08 Practical example

🌎 Follow me here:
Discord:   / discord  
Twitter:   / tomdoes_tech  
Facebook:   / tomdoestech​  
Instagram:   / tomdoestech​  
TikTok:   / tomdoes_tech  
☕ Buy me a coffee: https://www.buymeacoffee.com/tomn


In questa pagina del sito puoi guardare il video online Observer Pattern - Design Patterns in JavaScript della durata di ore minuti seconda in buona qualità , che l'utente ha caricato TomDoesTech 24 marzo 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 8,355 volte e gli è piaciuto 256 spettatori. Buona visione!