me-12 / single-spa-portal-example

Example project on how to combine multiple SPA's on a single Website
MIT License
407 stars 136 forks source link

Adding middleware with globalEventDistributer as an argument #58

Open joelephroni opened 6 years ago

joelephroni commented 6 years ago

How would you pass the globalEventDistributer into middleware as an argument given that the portal gets the store from a store file and the globalEventDistributer is seen first as a prop on root.component? I would really prefer not to have to pass the globalEventDistributer around through the entire component tree... :)

joelephroni commented 5 years ago

Thank you! :) In your wisdom you knew that if you did not answer I would figure it out! Like a true Zen master you teach without teaching... :) I ended up making a combination component/middleware thingy that enables me to dispatch any GLOBAL_[ACTION_NAME] and expect it to be dispatched by the global event distributor. let me know if you want to see it. Peace.

abbudao commented 5 years ago

Mind showing it to me? I'm really interested on having a Middleware for the globalEventDistributer.