rhythnic / riot-redux

A suggested architecture for riot and redux, includes mixin
MIT License
10 stars 2 forks source link

_store.dispatch or trigger()? #1

Open kokujin opened 8 years ago

kokujin commented 8 years ago

I like your redux implementation, its a lot easier to understand :). Is there a reason why you are not using riot.js own "trigger()" method to dispatch messages instead of the not broadly supported object.dispatch method?

rhythnic commented 8 years ago

The dispatch method is from the Redux API. The store is a Riot observable that's instantiated with a Redux store, so it contains both APIs in one object. The idea was to use trigger to emit events and dispatch to emit actions to the store. Now that I know about Redux Saga, I might have done it differently, omitting the Riot observable, mainly because of how easy Redux Saga makes it to do testing, but using the observable for async events keeps things simple.