Add sync baseStore
Adds synchronous event handling. This helps to avoid inconsistent data when 2 events arrive at the same time. This makes the store part of functional programming.
To implement your store, you need:
- declare your events and states
- override the behavior of the reduce method, which acts as a function: newState = f ( event, oldState )
Hello. Thanks for PR. This is a rather unusual problem when events come from different threads and there is a need for them to be processed synchronously. In my practice this was not necessary. In general, it's recommended to design viewmodel so that events do not depend on each other and there is no need for sequential processing.
I don't think it should be part of the library. You can always inherit from BaseSharedViewModel and add the desired implementation of obtainEvent