vuestorefront / vue-storefront

Alokai is a Frontend as a Service solution that simplifies composable commerce. It connects all the technologies needed to build and deploy fast & scalable ecommerce frontends. It guides merchants to deliver exceptional customer experiences quickly and easily.
https://www.alokai.com
MIT License
10.62k stars 2.08k forks source link

Replace EventBus with actions #3020

Closed lukeromanowicz closed 4 years ago

lukeromanowicz commented 5 years ago

What is the motivation for adding / enhancing this feature?

As we are using vuex, there is no point in mixing it with an event bus. We should replace all events with actions while still dispatching events inside these actions for backward compatibility untill the next major release.

What are the acceptance criteria

Can you complete this feature request by yourself?

Which Release Cycle state this refers to? Info for developer.

Pick one option.

Additional information

pkarw commented 5 years ago

As it may sound easy with the events that have just a single listener (eg. https://github.com/DivanteLtd/vue-storefront/blob/20b693e28eeac810252593e1b42e709cc03701e9/core/modules/order/hooks/beforeRegistration.ts#L19) it's not so easy to replace EventBus for events that have multiple/dynamic listeners.

Let's say the events used by the payments modules (https://github.com/danrcoull/vsf-payment-braintree/blob/d42a2e6f2ccc227aad6c183ea8c089da032a73cb/hooks/beforeRegistration.ts#L25)

We need to have some proposal on how to handle the other cases