Hey I have a doubt here about the implementation regarding the prototypal inheritance. Isn't when here methods like subscribe, subscribeOnce etc are defined on the Event constructor then each instance of the Event constructor will have it's own copy of methods and that's not ideal. Wouldn't it will be better to to define these methods on Events.prototype or use class syntax?
@@9709923699 if you to share the data have shared instance. For example sending notification, you want same instance to be used everywhere thus share it
I'm loving these designs patterns video . please let them coming sir ❤🎉
Top notch content
Do we also need to handle subscribeOnceCallbacks and subscribeOnceAsyncCallbacks in publishAll method?
yes
Did you made the video for practicing or educating people?
I practice and people can educate watching this.
Hey I have a doubt here about the implementation regarding the prototypal inheritance.
Isn't when here methods like subscribe, subscribeOnce etc are defined on the Event constructor then each instance of the Event constructor will have it's own copy of methods and that's not ideal.
Wouldn't it will be better to to define these methods on Events.prototype or use class syntax?
We use constructors to create private instances, if you want shared instance use prototype
Okay thanks,
Can you give some examples where private instances will make sense and where shared instances will make more sense?
@@9709923699 if you to share the data have shared instance. For example sending notification, you want same instance to be used everywhere thus share it