Using an Singleton with Observer Pattern to manage State?
w3bwizart
Posted on November 12, 2019
A general question, I created a Singleton which will use an Observer Pattern where the Singleton becomes the Subject. And every Web Component in my app could become an Observer.
What is Pro/Con here? The main issue I found is that with Pub/Sub the Subject & Observer are loose coupled and work over messages. But is it so bad to use the Observer pattern in a Single Page app in a way everything should be together no?
I wonder what you people think of this? And no I don't want to use Redux or NGRX or any other library.
Looking forward to your feedback or comments.
💖 💪 🙅 🚩
w3bwizart
Posted on November 12, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.