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